Possible error in Raft Paper?

140 views
Skip to first unread message

Luca Lovagnini

unread,
Feb 18, 2015, 12:48:56 PM2/18/15
to raft...@googlegroups.com
Hi everybody! I'm trying to implement raft for a Distributed System project, and I find AMAZING the Raft Paper: it's clear, it's simple, and there that fantastic condensed summary about the Raft algorithm which is extremely useful for a Raft implementation!

However, I think that there could be an error in Figure 2 (the condensed summary indeed) in Request Vote RPC part, in particular:

Receiver implementation:
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)

I think that this is wrong, since if the currentTerm was updated (so term>currentTerm) the follower will grant its vote, even if he voted previously for a different candidate. I simulated it through Raft Visualization and I could have seen that I'm right.

Do you think that am I missing something or I am actually right?

Thanks so much and thanks for your replies!

Luca Lovagnini

unread,
Feb 18, 2015, 1:03:47 PM2/18/15
to raft...@googlegroups.com
UPDATE: I made a particular test through Raft Visualization to check the value of votedFor once that a node switch from Leader/Candidate to Follower: unless it switches back to Follower because of a RequestVoteRPC (and in that case it votes for the candidate), then the value of votedFor will be null.

In conclusion, for what I understand every time that a node switch to Follower state it will set votedFor to null. This is not reported under Rules For Servers / Followers (§5.2) and I think that's a crucial point. 

Do you agree with me?

Oren Eini (Ayende Rahien)

unread,
Feb 18, 2015, 1:14:46 PM2/18/15
to Luca Lovagnini, raft...@googlegroups.com
A node will switch to follower state only if it got a message with a higher term.
VotedFor is a value that is for the current term, so that is why it is set to null.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luca Lovagnini

unread,
Feb 18, 2015, 1:20:02 PM2/18/15
to raft...@googlegroups.com, lucal...@gmail.com
I totally agree, but I think that it would have been more clear if in the paper was explicitly writtern to reset votedFor to null every time that a Node switches to Follower,  but tjhis is only my opinion ;)  
Reply all
Reply to author
Forward
0 new messages