3 ms·
In the example with 5 nodes and a split, it is my understanding that the two nodes can't elect a leader. While the candidate in the smaller split receives vote
by pepijndevos 12y ago
In the example with 5 nodes and a split, it is my understanding that the two nodes can't elect a leader.
While the candidate in the smaller split receives votes from a majority of the split, there is no true majority, so no leader. The cluster is configured with the total number of nodes.
What could happen is that an already elected leader continues to think it's the leader for a while while the rest fo the cluster elects a new leader. The split leader will however fail to commit its log, and throw them away once it rejoins.
Another important detail that's missing is that node only votes once pere term, and only for a node that has an equal or higher term than itself. It will never vote twice or vote for an outdated node.
Changing the configuration is in fact handled in a special way at the end of the raft paper in a way that avoids split-brain.
[edit] Oh, the 2-node split was in fact already the leader, so it does exactly what I described. Dur...