What happens when leader crashes before all followers updates the commit index?
For example, node A, B, C forms the cluster:
only A and B alive and A is leader
A replicates an entry (let's say it's entry1) to B and get successful result from B
A commits entry1, and crashes before it send out the heartbeat message to B (which would results in B updates its commit index)
C online now
My questions is:
- would C be elected as new leader? If so, then entry1 is lost? Moreover, if A re-joins later, its data would be inconsistent with others?
I know the raft spec said:
Raft uses a simpler approach where it guarantees that all the committed entries from previous terms are present on each new leader from the moment of its election, without the need to transfer those entries to the leader.
But here entry1 may be not considered as committed entry? because B has not get the confirm from old leader (heartbeat from leader). So C get chances to be new leader?
- if B becomes new leader, then how it should deal with the entry1?