23 Raft AppendEntries

Conflict inAppendEntries

  1. Conflicting entries can exist.
    • different leaders append, 1 leader crash b4 replicating entries fully, later another leader elected
  2. Only 1 of those entries can be actually committed
    • Only when stored in majority & in the log of current leader
  3. Reconciliation mechanism
    • If follower's log doesn't match, delete and replace, and Append any new entries not already in the log

2 Servers think they're leader at same time

Pasted image 20251029021228.png
that's fine. Term 1 cannot commit (since never will be majority), when they get back, they follow Term 2's log

Commit Entry from Previous Terms

If there exists an N such that N > commitIndex, a majority of matchIndex[i] ≥ N, and log[N].term == currentTerm: set commitIndex = N.

You can only commit entry that belongs to your term.
Pasted image 20251029021454.png