Great write-up - what I would add is that this algorithm rest on the assumption that all nodes are behaving honestly and are not malicious. Which of course is true for most distributed systems we build, but is not true for public blockchains, like Bitcoin for example :)
"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?
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.
Great write-up - what I would add is that this algorithm rest on the assumption that all nodes are behaving honestly and are not malicious. Which of course is true for most distributed systems we build, but is not true for public blockchains, like Bitcoin for example :)
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?
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
As someone not that familiar with the subject, I found it easy to follow. Thanks.