wang
wang

Reputation: 53

How raft node know itself has voted after an crash recover?

If an raft node has voted for some candidate ,then crash before it could persistent the vote info, will the server has re-vote ability after restart?

Upvotes: 0

Views: 257

Answers (1)

Khanh TO
Khanh TO

Reputation: 48982

The way this should work is to persist the vote first before sending the vote.

In the worst case when the candidate does not receive enough votes (due to many crashes right after persisting or the vote is lost when being sent over the network), just start the election again.

Please note the highlighted text from raft paper: https://raft.github.io/raft.pdf

enter image description here

This could be confirmed by https://raft.github.io/ visualization:

enter image description here

enter image description here

Upvotes: 1

Related Questions