Three-phase commit explained in plain terms is the story of a small fix to a well-known protocol that turned out to be harder than it looked. The central question is what happens when the coordinator of a distributed transaction crashes at the worst possible moment, and the answer is a third phase that lets the remaining participants decide together instead of waiting forever.
Two-phase commit is the standard way to make several databases agree on a single transaction, but it has a flaw: if the coordinator fails after some participants have voted yes, the rest are stuck, unable to commit and unable to abort. Three-phase commit adds a step that removes that stuck state, at least in theory.
This article explains how three-phase commit works, what it fixes, what it does not fix, and why you will rarely find it in production.
Key takeaways
- Three-phase commit adds a prepare-to-commit phase to two-phase commit.
- It removes the blocking state that traps participants when a coordinator crashes.
- Participants can elect a new coordinator and finish the transaction themselves.
- It still fails if the network splits at the wrong moment.
- Most real systems use two-phase commit or consensus instead.
What three-phase commit is
Three-phase commit is a protocol for atomic commitment across several machines, designed by Dale Skeen in 1981 as an improvement on two-phase commit. It keeps the same goal, that a transaction either commits everywhere or nowhere, and it keeps the same cast of characters, a coordinator and a set of participants, but it splits the decision into three steps instead of two.
The extra step is called prepare to commit, and it sits between the vote and the final decision. Its job is to make sure that every participant knows the outcome is going to be commit before any of them is told to commit, so that no participant is ever left guessing about what the others decided.
The protocol is non-blocking, which is its headline claim. In two-phase commit, a participant that has voted yes and then hears nothing must wait, because the coordinator might have decided to commit and might have told some other participant already. In three-phase commit, that waiting state disappears, because the prepare phase guarantees that a participant either knows the outcome or knows that nobody else could have committed yet.
How two-phase commit blocks
To see the fix, it helps to see the flaw clearly. In two-phase commit, the coordinator first asks every participant to prepare, and each one votes yes or no. If all vote yes, the coordinator sends a commit message; if any votes no, it sends abort. The trouble starts when the coordinator crashes between collecting the votes and sending the decision.
A participant that voted yes and then hears nothing is trapped. It cannot commit on its own, because the coordinator might have decided to abort, and it cannot abort, because the coordinator might have decided to commit and told another participant. It must wait for the coordinator to return, holding its locks the whole time, and the wait can last indefinitely.
This is not a rare edge case. Coordinators crash, networks drop messages, and a blocked participant holds locks that other transactions need, so one crash can freeze a whole chain of work. Our guide to two-phase commit explains the two-phase version of the problem in full, and it is the baseline that three-phase commit is measured against.
The three phases in detail
Phase one is the same as before: the coordinator asks every participant whether it can commit, and each one checks its local state and votes yes or no. A participant that votes yes records that vote durably, so that it survives a crash, and then waits for the next phase.
Phase two is the new step. If every participant voted yes, the coordinator sends a prepare-to-commit message to all of them. Each participant acknowledges it, and in doing so moves into a state where it knows the transaction will commit. The crucial point is that no participant commits yet; it only learns that commit is the outcome.
Phase three is the actual commit. The coordinator sends the commit message, and each participant applies the transaction and releases its locks. Because every participant already passed through the prepare stage, each one knows the outcome even if the coordinator disappears at this point.
If any participant votes no in phase one, or fails to answer, the coordinator sends abort instead, and the transaction is rolled back everywhere. The abort path skips the prepare phase entirely, because there is nothing to prepare for.
How recovery works
The recovery procedure is where the extra phase earns its keep. When the coordinator fails, the participants run an election among themselves and choose a new coordinator, usually the participant with the most complete information about the transaction.
The new coordinator asks every participant what state it is in. If any participant is in the prepare-to-commit state, the transaction must commit, because that state proves the old coordinator had already decided to commit. If no participant reached prepare, the transaction must abort, because nobody could have committed yet.
Either way, the new coordinator can reach a decision without waiting for the old one to return, and the participants can finish the transaction and release their locks. That is the non-blocking property, and it is the whole reason the protocol exists.
There is a catch, and it is a serious one. The recovery logic assumes that the participants can all talk to each other, and if the network is partitioned so that some cannot, the election can reach the wrong conclusion. Our guide to the CAP theorem explains why no protocol can guarantee both consistency and availability during a partition, and three-phase commit is no exception.

Three-phase commit compared with its rivals
Three-phase commit is one of several ways to settle a distributed transaction, and each makes a different compromise between safety, liveness, and complexity. Two-phase commit is simpler but can block, while consensus protocols avoid the problem entirely by never having a single coordinator whose failure matters.
The table below sets out the main contrasts.
| Aspect | Three-phase commit | Two-phase commit | Consensus protocol |
|---|---|---|---|
| Blocking on coordinator crash | No, participants recover together | Yes, voters wait indefinitely | No, a new leader is elected |
| Survives a network partition | No, can decide wrongly | No, blocks instead | Yes, on the majority side |
| Message rounds | Three | Two | Two or more, with elections |
| Complexity | High, recovery is subtle | Low, widely understood | High, but well tested |
| Use in production | Rare | Common | Common in modern systems |
The practical result is that three-phase commit sits in an awkward middle: more complex than two-phase commit, yet less robust than consensus, which is why it is studied far more often than it is deployed.
Why it sees so little real use
The first reason is that its guarantee is weaker than it appears. Three-phase commit is non-blocking only when the network stays connected, and a partition at the wrong moment can still produce an inconsistent outcome. A protocol that fails in exactly the situation it was designed for is a hard sell.
The second reason is the extra round of messages. Every transaction pays for an additional phase, which adds latency to the common case in exchange for safety in a rare one, and most teams would rather spend that budget elsewhere.
The third reason is that consensus protocols such as Paxos and Raft solve the same problem more thoroughly. They elect a leader, replicate a log, and survive partitions on the majority side, and they have been battle-tested in production for years. Our guide to Paxos explains the oldest of these protocols, and it is the standard against which three-phase commit is now judged.
There are niches where three-phase commit still appears, usually in textbooks and in systems where a partition is considered unlikely enough to ignore. It also lives on as a teaching tool, because the step from two phases to three makes the blocking problem concrete in a way that abstract discussion never does.
Strengths and limits
The greatest strength of three-phase commit is that it removes the most painful failure mode of two-phase commit without changing the basic shape of the protocol. Teams that already understand two-phase commit can grasp the fix quickly, and the recovery procedure is elegant when the network cooperates.
It is also a strength that the protocol needs no extra infrastructure. There is no separate consensus service to run, no log to replicate, just one more round of messages between the participants that are already involved.
The limits, though, are decisive for most production use. It cannot survive a partition, it adds latency to every transaction, and its recovery logic is subtle enough that implementing it correctly is a serious undertaking. For most teams, those costs outweigh the benefit of removing a blocking state that, in practice, is usually handled by a timeout and a human.
Three-phase commit checklist
- Understand the blocking state of two-phase commit before adopting the fix.
- Record every vote durably so recovery can trust the participants.
- Elect a new coordinator from the participants when the old one fails.
- Commit if any participant reached prepare-to-commit, abort otherwise.
- Do not rely on it across a network partition; it can decide wrongly.
- Measure the extra round of messages against your latency budget.
- Consider a consensus protocol if partitions are a real risk.
- Test coordinator failure at each phase, not just at the start.
- Keep the recovery logic simple; subtle bugs here corrupt data.
Frequently asked questions
What is three-phase commit in simple terms?
It is two-phase commit with an extra prepare-to-commit step, so that participants can finish a transaction themselves when the coordinator crashes, instead of waiting forever.
What problem does the third phase solve?
It removes the blocking state in which a participant that voted yes cannot tell whether the transaction committed or aborted, because the prepare phase proves the outcome in advance.
Is three-phase commit non-blocking?
Yes, but only when the network stays connected. During a partition it can reach the wrong decision, so its non-blocking claim comes with a real condition attached.
Why is three-phase commit rarely used?
Because it adds latency and complexity, still fails under partitions, and consensus protocols such as Paxos and Raft handle the same failures more robustly.
What happens if a participant crashes during three-phase commit?
The coordinator treats a missing vote or acknowledgement as a no, and aborts the transaction, so the crashed participant rejoins later and rolls back.
How is three-phase commit different from Paxos?
Paxos is a consensus protocol that replicates a log and elects leaders, while three-phase commit is a commit protocol for one transaction; Paxos survives partitions on the majority side, three-phase commit does not.
The bottom line
Three-phase commit explained in one line is this: one extra phase removes the waiting, but only while the network holds together.
It is a clever protocol that taught the field a great deal about the blocking problem, even though the systems that followed it chose a different answer.
This article is general information about how three-phase commit works, not advice about choosing a commit protocol for a particular system.







