-
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: do not attach term to MsgReadIndex #6749
Conversation
nt.send(raftpb.Message{From: 3, To: 3, Type: raftpb.MsgHup}) | ||
|
||
// to old leader r1 | ||
r2.Step(raftpb.Message{ |
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.
this is not correct. r2 should step message sent to itself (To:2). It should not step a message sent to 1.
@@ -190,6 +190,44 @@ func TestNodeReadIndex(t *testing.T) { | |||
} | |||
} | |||
|
|||
// TestNodeReadIndexToOldLeader ensures that raftpb.MsgReadIndex to old leader | |||
// gets forwarded to the new leader and 'send' method does not attach its term. | |||
func TestNodeReadIndexToOldLeader(t *testing.T) { |
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.
probably all we want to test here is:
- elect 1 as leader
- send readindex request to 2
- verify 2 forwards this message to 1 with term not set
- send readindex request to 3
- verify 3 forwards this message to 1 with term not set as well.
- now elect 3 as leader
- let 1 steps the two messages previously we got from 2, 3
- verify 1 forwards these messages again to the new leader 3
@xiang90 Just fixed test. PTAL. Thanks! |
@gyuho Will the test panics (or fails) without the patch? |
@xiang90 Yes it detects the term attached to
|
LGTM |
Fix etcd-io#6744. MsgReadIndex, as MsgProp, is to be forwarded to leader. So we should treat it as local message.
Thanks. Merging in greens. |
Fix #6744.
MsgReadIndex
, asMsgProp
, is to be forwarded to leader.So we should treat it as local message.
@xiang90