Trying to Fix 2PC
Computer scientists recognized 2PC's blocking problem and proposed Three-Phase Commit (3PC) as a solution. It inserts an additional phase between Prepare and Commit:
- CanCommit? — Coordinator asks participants if they could commit (no locks yet).
- PreCommit — Coordinator tells participants to prepare and acquire locks. Participants acknowledge.
- DoCommit — Coordinator tells participants to finalize.
The key addition is that participants now know the coordinator's intent before they acquire locks. If the coordinator crashes after PreCommit, participants can use timeouts and communicate with each other to decide whether to commit or abort — without waiting indefinitely for the coordinator to recover.
Why You Won't See It in Practice
3PC solves the blocking problem under certain failure models, but introduces new problems:
- Network partitions break it: 3PC assumes that message delays are bounded (i.e., a timeout means failure). In real networks, a slow message and a crashed node look identical. A partition can cause participants on different sides to make different decisions — some commit, some abort — violating atomicity.
- Complexity: Three phases means more network round-trips, more code to implement correctly, and more edge cases to handle.
- Performance: The extra phase adds latency to every transaction.
In practice, almost no production distributed systems implement 3PC. The industry moved in a different direction entirely: accepting that strong distributed consistency is expensive, and designing applications to work correctly with eventual consistency instead.