-
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: leader respond to learner read index message #10590
Conversation
In this case, does the leader need to check if it has committed any log entry at the current term? |
Codecov Report
@@ Coverage Diff @@
## master #10590 +/- ##
==========================================
- Coverage 71.6% 71.49% -0.11%
==========================================
Files 393 393
Lines 36568 36571 +3
==========================================
- Hits 26183 26146 -37
- Misses 8549 8588 +39
- Partials 1836 1837 +1
Continue to review full report at Codecov.
|
lgtm |
Leader should check message sender after receiving MsgReadIndex, even when raft quorum is 1. The message could be sent from learner node, and leader should respond.
60224f3
to
5088d70
Compare
} else { // there is only one voting member (the leader) in the cluster | ||
if m.From == None || m.From == r.id { // from leader itself | ||
r.readStates = append(r.readStates, ReadState{Index: r.raftLog.committed, RequestCtx: m.Entries[0].Data}) | ||
} else { // from learner member |
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.
i just hit the merge button... but actually you can check if m.From is indeed a learner for extra safety.
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.
Since here we have r.quorum()==1
, which means r.prs
only has leader itself?
Leader should check message sender upon receiving MsgReadIndex message, even when raft quorum is 1. The message could be sent from learner node. In this case, leader should respond to the sender.
Fixes #10589.
cc @xiang90 @gyuho @WIZARD-CXY @jpbetz