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 votes need to advertise their commit_idx instead of their last_idx #520

Closed
olgavrou opened this issue Nov 5, 2019 · 1 comment
Closed

Comments

@olgavrou
Copy link
Contributor

olgavrou commented Nov 5, 2019

When there is an election in Raft, nodes currently send their last_idx to indicate their state. Nodes compare their last_idxs to decide whether to vote for a candidate or not.

This can lead to nodes being elected even though they are further behind. If node (A) is at last_idx 2 but commit_idx 1 and node (B) is at last_idx 2 and commit_idx 2, then node (A) can win an election even though it will immediately after rollback to it's commit_idx 1, leaving the follower ahead of the leader.

This can be fixed by using commit_idx instead of last_idx to vote.

@achamayou
Copy link
Member

No impact other than performance effectively (the window of loss on election is greater than it could be).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants