-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
raft: raft learners should be returned after applyConfChange #9116
Conversation
/cc @siddontang can you please take a look? |
Codecov Report
@@ Coverage Diff @@
## master #9116 +/- ##
==========================================
- Coverage 76.25% 76.12% -0.14%
==========================================
Files 359 359
Lines 29983 29987 +4
==========================================
- Hits 22864 22827 -37
- Misses 5541 5576 +35
- Partials 1578 1584 +6
Continue to review full report at Codecov.
|
Do we use the node function outside of raft lib? if yes, we should also handle learner nodes now. |
639ab57
to
935fe85
Compare
Currently, as I know it is used only by raft lib. If any future usage maybe another pr needed. |
raft/node_test.go
Outdated
s.Append(rd.Entries) | ||
t.Logf("raft: %v", rd.Entries) | ||
for _, ent := range rd.Entries { | ||
if ent.Type == raftpb.EntryConfChange { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is crazy here. let us kill one indentation by doing
if ent.Type != raftpb.EntryConfChange {
continue
}
var cc raftpb.ConfChange
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
raft/node_test.go
Outdated
if len(state.Learners) == 0 || | ||
state.Learners[0] != cc.NodeID || | ||
cc.NodeID != 2 { | ||
t.Fatalf("apply conf change should return new added learner: %v", state.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use t.Errorf
raft/node_test.go
Outdated
} | ||
|
||
if len(state.Nodes) != 1 { | ||
t.Fatalf("add learner should not change the nodes: %v", state.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use t.errorf
@absolute8511 Can you rebase with master? Looks good to me. @siddontang can you give this a final look? |
Rest LGTM |
935fe85
to
fa3f3f9
Compare
@absolute8511 can you please rebase with master, and resolve the merge conflicts? thank you. |
fa1a0e5
to
75cdeef
Compare
75cdeef
to
11fa4f0
Compare
All done @xiang90 |
This should fix issue #9087