title: raft: committed entry may be lost?
body: <p>What happens when leader crashes before all followers updates the commit index?</p>
  
  <p>For example, node A, B, C forms the cluster:</p>
  
  <ul>
  <li><p>only A and B alive and A is leader</p></li>
  <li><p>A replicates an entry (let's say it's entry1) to B and get successful result from B</p></li>
  <li><p>A commits entry1, and crashes before it send out the heartbeat message to B (which would results in B updates its commit index)</p></li>
  <li><p>C online now</p></li>
  </ul>
  
  <p>My questions is:</p>
  
  <ul>
  <li>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?</li>
  </ul>
  
  <p>I know the raft spec said:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>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?</p>
  
  <ul>
  <li>if B becomes new leader, then how it should deal with the entry1?</li>
  </ul>