Safety Argument: Committing Entries from Current Term
What you'll learn: Why Raft leaders only commit entries from their current term directly, and how older entries become committed indirectly.
The Core Safety Rule
In Raft, a leader can only mark an entry as committed if it's from the leader's current term and has been replicated to a majority of servers. Entries from older terms cannot be committed directly—they piggyback on newer entries.
Why This Restriction Exists
Imagine a leader replicates an old entry to a majority, then crashes before committing it. A new leader with a longer log might get elected and overwrite that entry. If the old leader had marked it committed based solely on replication count, we'd violate safety: a "committed" entry would disappear.
The analogy: Think of it like signing a contract. You can only sign contracts you personally drafted (current term). Old drafts from previous managers need to be bundled with your new paperwork—when your version is approved, the old ones are grandfathered in.
How Old Entries Get Committed
When a leader commits an entry from its current term, all preceding entries in its log automatically become committed too. This works because:
- The Log Matching Property guarantees identical history up to any index
- The Election Restriction ensures new leaders have all committed entries
- Committing a current-term entry proves the entire prefix is safe
So leaders don't commit old entries directly—they wait until a new entry from their term replicates to a majority, then commit everything up to that point.
Key Takeaway: Leaders only commit entries from their current term directly; old entries become committed indirectly when newer entries reach majority replication, preventing safety violations from stale replications.