Leader election and Candidate Rigging

54 views
Skip to first unread message

Sam Riyad

unread,
Dec 21, 2016, 12:51:35 AM12/21/16
to raft-dev
I am making an impelementation in Scala and I am almost finished but something bugs me. I remember diego talking
about rigging who can become candidates and I mean if there are only 3 nodes and both candidates vote for themselves there could be a fault. So I added a potential candidate option as a boolean. I haven't seen this in other implementations am I paranoid over nothing?

Oren Eini (Ayende Rahien)

unread,
Dec 21, 2016, 2:58:15 AM12/21/16
to raft...@googlegroups.com
I'm not aware of something special with candidate rigging except when a leader steps down.
Then, it select a follower, tell it to immediately initiate elections, and there is a high likelihood it will be the next leader.

But the issue of two candidates trying to win at the same time is resolved using randomized timeouts

Hibernating Rhinos Ltd  

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

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

 


On Wed, Dec 21, 2016 at 7:51 AM, Sam Riyad <iamgodbowbe...@gmail.com> wrote:
I am making an impelementation in Scala and I am almost finished but something bugs me. I remember diego talking
about rigging who can become candidates and I mean if there are only 3 nodes and both candidates vote for themselves there could be a fault. So I added a potential candidate option as a boolean. I haven't seen this in other implementations am I paranoid over nothing?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sam Riyad

unread,
Dec 24, 2016, 1:52:01 AM12/24/16
to raft-dev
I tried random timeouts it doesn't work.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Dec 24, 2016, 10:03:32 AM12/24/16
to raft...@googlegroups.com
Explain what you mean with doesn't work?
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+unsubscribe@googlegroups.com.

jordan.h...@gmail.com

unread,
Dec 25, 2016, 7:47:19 PM12/25/16
to raft...@googlegroups.com
To be clear and ensure your implementation is correct: the general idea is that you use randomized timeouts to reduce the likelihood of two followers becoming candidates and voting for themselves at the same time. But even if this does happen, it shouldn't prevent your system from progressing. Election timers still run during the elections, so the new randomized timeouts should cause one of the two candidates to timeout before the other, start another election, vote for itself, and request a vote from the other before its time expires. It's okay for it to take multiple rounds to elect a new leader (though the fewer the better). The chance that randomized timers will repeatedly expire at the same time on multiple nodes through multiple rounds is low.

What you may be referring to is the pre-vote protocol. If in this scenario, only one of the nodes could even get elected, what you can do is essentially do a round of voting to determine whether a follower can win an election *before* ever actually starting a new election. At least, that's the basic idea. See section 4.2.3 on disruptive nodes in Diego's dissertation for a description of the correct way to implement this.

Also, if your work is open source I'd be glad to assist with a code review and some collaboration. I work mostly in Java, but about 30% of my day job is Scala work.
Reply all
Reply to author
Forward
0 new messages