Raft Safety Proof: State Machine Safety Property
You'll learn the fundamental safety guarantee that makes Raft a correct consensus algorithm: committed entries are never lost.
The Core Safety Promise
Raft's State Machine Safety Property states: if a server has applied a log entry at a given index to its state machine, no other server will ever apply a different command for that same log index.
In simpler terms: once Raft commits an entry (meaning it's been replicated to a majority and applied to state machines), that decision is permanent and universal. Every server that applies index 5 will see the exact same command—forever.
Why This Matters
Imagine a distributed banking system. If one server executes "transfer 50 from Alice to Carol" at the same index, you've violated the integrity of your replicated state machine. Accounts would diverge catastrophically.
The Intuition Behind Correctness
Raft ensures this property through three interlocking mechanisms you've already studied:
- Commitment rules: An entry becomes committed only when stored on a majority of servers in the current term
- Leader election restriction: A candidate can only become leader if its log contains all committed entries (it must receive votes from a majority, which overlaps with the commit majority)
- Log matching property: Leaders never overwrite their own entries; they only fix follower inconsistencies by making followers match the leader's log
These pieces work together like a ratchet: once an entry commits, any future leader must have it, and therefore will preserve it and propagate it.
Key Takeaway: The State Machine Safety Property guarantees that committed log entries are permanent and identical across all servers, preventing divergent state machine execution—the cornerstone of Raft's correctness proof.