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

Handle RequestVote correctly if the Candidate has stale log #10

Open
jkozlowski opened this issue Dec 13, 2013 · 0 comments
Open

Handle RequestVote correctly if the Candidate has stale log #10

jkozlowski opened this issue Dec 13, 2013 · 0 comments

Comments

@jkozlowski
Copy link
Contributor

This is following #9 code review. Similarly to what we do in the follower, leaders and candidates should check if the node requesting a vote has the log at least as up-to-date as ours, otherwise we should not grant the vote.

Receiver implementation (for RequestVote):

  1. Reply false if term < currentTerm (§5.1)
  2. If votedFor is null or candidateId, and candidate's log is at
    least as up-to-date as receiver’s log, grant vote (§5.2, §5.4)

Additionally, looking at go code, RequestVote handling is exactly the same for all node types, so maybe it would be good to refactor that bit of state somehow, so that we can have a generic function for handling it?

I wouldn't mind taking a stab at this over the next week, just need a bit of time to setup a new machine a just bought...

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

1 participant