Skip to content
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: clarify candidate message handling, test candidate to follower transition with message from leader #9345

Merged
merged 2 commits into from
Feb 25, 2018

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Feb 22, 2018

raft.Step already ensures that when m.Term > r.Term, candidate reverts back to follower with its term being reset with m.Term, thus it's always true that m.Term == r.Term in stepCandidate. This just makes r.becomeFollower calls consistent. Also add tests around this behavior.

Also document why stepCandidate should reuse candidate's own term, not m.Term. This is because pre-vote is requested with future term.

`raft.Step` already ensures that when `m.Term > r.Term`,
candidate reverts back to follower with its term being
reset with `m.Term`, thus it's always true that
`m.Term == r.Term` in `stepCandidate`.

This just makes `r.becomeFollower` calls consistent.

Signed-off-by: Gyuho Lee <[email protected]>
…ndidate

"stepCandidate" should reuse candidate's own term, not term in Message,
because pre-vote is requested with future term.

Signed-off-by: Gyuho Lee <[email protected]>
@gyuho gyuho merged commit 2dd1a99 into etcd-io:master Feb 25, 2018
@gyuho gyuho deleted the raft-step-candidate branch February 25, 2018 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants