Three-Phase Commit
The non-blocking fix to 2PC — an extra round lets participants decide on their own.
How Three-Phase Commit Works
Three-Phase Commit (3PC) was designed to fix the blocking problem in Two-Phase Commit. In 2PC, if the coordinator crashes after sending PREPARE but before broadcasting its decision, participants that voted YES are stuck — they can't commit or abort on their own. 3PC adds an extra round to eliminate this window.
The protocol has three phases:
Phase 1 — CanCommit. The coordinator asks each participant: "Can you commit?" Each participant checks its constraints and votes YES or NO. Same as 2PC's prepare phase.
Phase 2 — PreCommit. This is the new phase. If all participants voted YES, the coordinator sends PRE-COMMIT to everyone. When a participant receives PRE-COMMIT, it knows the coordinator's intent to commit — and crucially, it knows that every other participant also voted YES. Participants acknowledge with an ACK. If any participant voted NO, the coordinator sends ABORT instead.
Phase 3 — DoCommit. Once the coordinator receives all ACKs, it sends DO-COMMIT. Participants apply the commit.
Why this fixes blocking. The key insight is about what participants can safely assume when the coordinator disappears. In 2PC, a participant in the PREPARED state knows nothing — the coordinator might have decided either way. In 3PC, a participant that received PRE-COMMIT knows every participant voted YES, so it can safely commit even without hearing from the coordinator. And a participant that hasn't received PRE-COMMIT can safely abort — if no one got the pre-commit message, no one will commit.
Try it: kill the coordinator after it sends PRE-COMMIT. Watch the participants time out and commit on their own — no blocking. Then reset and kill the coordinator before PRE-COMMIT — participants safely abort. Compare this with the 2PC lab where killing the coordinator leaves participants stuck forever.
The catch. 3PC only works under certain failure assumptions — specifically, it assumes no network partitions. If the network splits and some participants got PRE-COMMIT while others didn't, the two groups can make different decisions: one commits, the other aborts. This is why 3PC never really caught on in practice — real networks have partitions. Instead, the industry moved to Paxos-based approaches that handle partitions correctly, trading availability for safety.