The Blocking Problem in 2PC
What you'll learn: Why a coordinator failure during Two-Phase Commit can freeze your entire distributed transaction system.
The Problem Emerges
After the coordinator sends "prepare" messages in Phase 1 and participants vote "yes," they enter a critical prepared state. In this state, participants have:
- Locked resources (rows, tables, etc.)
- Committed to either abort or commit based on the coordinator's decision
- Lost their autonomy — they cannot unilaterally decide what to do next
Now imagine the coordinator crashes before sending commit/abort messages in Phase 2.
Why This Causes Blocking
Participants are now stuck. They cannot:
- Commit on their own — another participant might have voted "no"
- Abort on their own — another participant might be committing
- Release locks — they don't know the final outcome
They must wait for the coordinator to recover, holding all locks and blocking other transactions that need those resources.
The Analogy
Think of a wedding ceremony where the officiant asks "Do you take this person...?" Both bride and groom say "yes," but before the officiant can say "I now pronounce you..." they faint. Everyone is frozen. Are they married? Not married? No one can leave or move forward until the officiant wakes up.
Duration of the Block
The blocking persists until:
- The coordinator recovers and reads its log to determine the outcome
- Manual intervention occurs (risky — requires checking all participants)
- A timeout forces an abort (loses atomicity if some participants committed)
Key Takeaway: 2PC is called a blocking protocol because coordinator failure after the prepare phase leaves participants in limbo, unable to make progress while holding critical resources locked.