Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
3764f758
Commit
3764f758
authored
2 years ago
by
Yaroslav Dynnikov
Browse files
Options
Downloads
Patches
Plain Diff
chore: replace another "if" with another "match"
parent
803d2a9a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!158
Refactor join loop (v2)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/traft/node.rs
+25
-25
25 additions, 25 deletions
src/traft/node.rs
with
25 additions
and
25 deletions
src/traft/node.rs
+
25
−
25
View file @
3764f758
...
...
@@ -406,33 +406,33 @@ fn handle_committed_conf_change(
// (`V2` or not `V2`) makes a significant
// difference in `entry.data` binary layout
// and in joint state transitions.
let
conf_state
;
if
entry
.entry_type
==
raft
::
EntryType
::
EntryConfChange
{
let
mut
cc
=
raft
::
ConfChange
::
default
();
cc
.merge_from_bytes
(
&
entry
.data
)
.unwrap
();
*
config_changed
=
true
;
conf_state
=
raw_node
.apply_conf_change
(
&
cc
)
.unwrap
();
}
else
if
entry
.entry_type
==
raft
::
EntryType
::
EntryConfChangeV2
{
let
mut
cc
=
raft
::
ConfChangeV2
::
default
();
cc
.merge_from_bytes
(
&
entry
.data
)
.unwrap
();
// Unlock the latch only when leaving the joint state
if
cc
.changes
.is_empty
()
{
if
let
Some
(
latch
)
=
joint_state_latch
{
latch
.notify
.notify_ok
(
entry
.index
);
*
joint_state_latch
=
None
;
*
config_changed
=
true
;
}
let
conf_state
=
match
entry
.entry_type
{
raft
::
EntryType
::
EntryConfChange
=>
{
let
mut
cc
=
raft
::
ConfChange
::
default
();
cc
.merge_from_bytes
(
&
entry
.data
)
.unwrap
();
*
config_changed
=
true
;
raw_node
.apply_conf_change
(
&
cc
)
.unwrap
()
}
raft
::
EntryType
::
EntryConfChangeV2
=>
{
let
mut
cc
=
raft
::
ConfChangeV2
::
default
();
cc
.merge_from_bytes
(
&
entry
.data
)
.unwrap
();
// Unlock the latch only when leaving the joint state
if
cc
.changes
.is_empty
()
{
if
let
Some
(
latch
)
=
joint_state_latch
{
latch
.notify
.notify_ok
(
entry
.index
);
*
joint_state_latch
=
None
;
*
config_changed
=
true
;
}
}
// ConfChangeTransition::Implicit implies that at this
// moment raft-rs will implicitly propose another empty
// conf change that represents leaving the joint state.
conf_state
=
raw_node
.apply_conf_change
(
&
cc
)
.unwrap
()
}
else
{
unreachable!
()
;
// ConfChangeTransition::Implicit implies that at this
// moment raft-rs will implicitly propose another empty
// conf change that represents leaving the joint state.
raw_node
.apply_conf_change
(
&
cc
)
.unwrap
()
}
_
=>
unreachable!
()
,
};
Storage
::
persist_conf_state
(
&
conf_state
)
.unwrap
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment