Practice this topic in a realistic system design interview
Two-Phase Commit has a painful weak spot. If the coordinator disappears after participants vote yes but before they receive the final decision, those participants are stuck. They cannot safely commit or abort on their own, so they wait, often while holding locks. Three-Phase Commit (3PC) is an atomic commit protocol designed to reduce that blocking problem.
It does this by adding one extra step between "everyone voted yes" and "commit now." That step tells participants more about what the group knows, so they may be able to make progress even if the coordinator disappears.
3PC is rarely used in production. It works only when the network behaves in very predictable ways: messages are not delayed forever, failures can be detected reliably, crashed machines stop cleanly, and the network does not split into isolated groups. Real systems rarely get all of that. Still, 3PC is worth learning because it shows why avoiding blocking is hard.
This chapter explains how 3PC reduces blocking, and why most production systems choose other approaches.
In 2PC, the dangerous state is prepared, also called in doubt.
A prepared participant knows only part of the story.
| What It Knows | What It Does Not Know |
|---|---|
| It voted yes | Whether every other participant voted yes |
| It can commit if told to commit | Whether the coordinator decided commit or abort |
| It must follow the final decision | Whether another participant already received that decision |
If participants knew everyone had voted yes before the coordinator failed, commit would be safe. If they knew at least one participant had not voted yes, abort would be safe.
3PC adds a phase to share exactly that missing information.