Hacker News new | ask | show | jobs
by BinaryIgor 219 days ago
Curious about this piece:

"By up-to-date, I mean that the follower will grant its vote only if the candidate’s last entry term (included in the RequestVote) is higher, or the candidate’s last entry index (also included) is higher for the same term. If the candidate’s log isn’t more up-to-date than the follower’s, the latter won’t grant its vote."

Is this why election timeouts are random? To guarantee that at least one candidate is more up-to-date than others, as measured by the last entry term?

1 comments

Election timeout is random to prevent split votes. The up-to-date restriction ensures that you can only get elected if you're ahead, which, combined with the requirement to gather the votes of the majority of the votes, ensures that the leader has all committed entries.

Check section 5.4.3 in the paper, where it proves it quite elegantly IMHO: https://raft.github.io/raft.pdf

Thanks :) It's a surprisingly simple algorithm for such a complex problem