In raft if a log replicated to majority, it is considered as committed in leader. Then leader send msg to follower to tell follower an entry become commit.If not, how and when follower know an entry become committed???
Another question,if an out of date can win an election in the following case? 5 nodes cluster, node A is the current leader.
A: 0 1 2 3 4
B: 0 1 2 3 4
C: 0 1 2 3 4
D: 0 1 2 3
E: 0 1
When node A (current leader) receive a request (entry 4), log it and replicated it to node B and node C. Then node A apply entry 4 in state machine and reply to client (In this point entry is considered committed by node B and node C or not ?). Then node A and node B crash, node D start new election vote itself and get vote by node E, then win the election. Will this case happen?
Note: a leader may only commit an index from his own term (see §5.4.2 Committing entries from previous terms in (1)). If a new elected leader wants to know what is the latest committed index, he needs to commit a no-op(eration) entry right after his election.
No. To receive a vote from another peer a node needs to have a log that is at-least-up-to-date1 as the log of the node he is trying to receive a vote from. (also the other node should not already grant a vote to somebody else in that given term)
1 Contains an entry from a later term. Or if the latest entries have the same term number it contains more entries.