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
Linearizability makes copies of one object act as one. A transaction over several stores asks for something different: one 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. A lock keeps other transactions off the data until released.
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 every store can abort.
Consensus lets machines agree on one value by majority. Running it on the decision removes the single decider: the replicas agree among themselves on commit or abort, so the survivors can finish as long as a majority is still up. 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.
Lesson, quiz and flashcard text written for this dataset and revised in the P25 source pass.
2 · Watch
به انگلیسیTake it off screen
Where it sits
Learn first
Optional connections
This opens up
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.