Distributed Transactions and the Blocking Case of Two-Phase Commit
A transaction spanning several stores needs one atomic decision. Two-phase commit gets it by making participants promise before the coordinator decides, and its known weakness is that a coordinator failure at the wrong moment leaves participants holding locks with nobody to ask.
What a learner can do afterwards
- Walk both phases and say what a participant has promised once it votes yes
- Identify the window where a coordinator failure blocks the participants
- Say how running consensus on the commit decision removes the blocking case, and what it costs
1 · Read
Like the single-object view for one store, a transaction that touches several stores needs a single outcome: commit everywhere or abort everywhere. Phase one: the coordinator asks every participant to prepare, and each votes yes or no. A yes vote is a promise: I will obey your decision, and I hold my locks until you tell me.
One order lives in two stores. The coordinator asks both. Both vote yes, so the coordinator sends commit and both commit. Had one voted no, the coordinator would send abort and both would drop the change. The decision is one; the stores just obey it.
The blocking window opens once a participant votes yes: it can no longer decide alone, because another store may already hold a commit order from the coordinator. If the coordinator crashes in that window, yes-voters wait with locks held and nobody can answer them. A crash before anyone voted yes is harmless, since everyone simply aborts.
Consensus on the decision removes the single decider: the replicas agree among themselves on commit or abort, so survivors always finish even when some fail. The price is extra rounds of messages on every commit, not just when something breaks.
Yes means obey and wait; a dead coordinator in that window leaves voters blocked.
2 · Watch
Take it off screen
Where it sits
8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.