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

Election optimization #229

Open
3 tasks
zavier-wong opened this issue Jul 24, 2022 · 4 comments
Open
3 tasks

Election optimization #229

zavier-wong opened this issue Jul 24, 2022 · 4 comments

Comments

@zavier-wong
Copy link
Contributor

zavier-wong commented Jul 24, 2022

  • Pre-Vote
  • Check Quorum
  • Leader Lease
@jovany-wang
Copy link
Collaborator

Thanks for the proposals. Maybe it's better to left the details on how we should implement them?

@zavier-wong
Copy link
Contributor Author

The specific process of the PreVote stage is to send a PreVote message to all nodes before initiating the real election (not much different from the actual voting message, but it will not automatically increase its own term), and the node that receives the message agrees to the conditions for re-election Yes:

  1. The term of the PreCandidate node is larger, or the term is the same but the log index is larger;
  2. The leader's heartbeat has not been received within at least one election timeout period;

Only when more than half of the nodes agree to PreVote, the node can self-increase the term to initiate a real election and send a RequestVote request.

@zavier-wong
Copy link
Contributor Author

Check Quorum is a mechanism for leaders to step down. The leader node sends a message to check whether it maintains more than half of the connections with other nodes in the cluster. If not, it becomes a follower node.

@zavier-wong
Copy link
Contributor Author

The leader lease mechanism means that the node will not vote for other nodes within an election timeout period when the node receives a message from the leader.

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

No branches or pull requests

2 participants