Course contentsShow
← System Design
Lesson 578 of 1,91916. Distributed TransactionsFree lesson

Blocking Nature of Two-Phase Commit

How 2PC blocks all participants during coordinator failure, causing system-wide unavailability.

Blocking Nature of Two-Phase Commit

What You'll Learn

You'll understand how 2PC can freeze all participants during a coordinator failure, creating system-wide unavailability.

The Core Problem

Two-Phase Commit has a critical vulnerability: it blocks during coordinator failure. Remember that participants in 2PC must wait for the coordinator's decision after voting "yes" in the prepare phase. If the coordinator crashes before sending commit/abort messages, all participants are stuck in an uncertain state—they've promised to commit but don't know if they should actually do it.

During this blocking period:

  • Participants hold locks on data
  • Resources remain reserved
  • No other transactions can access the locked data
  • The entire system waits for coordinator recovery

Why This Happens

In the prepare phase, participants vote and then must wait for the coordinator's final decision. They cannot unilaterally decide to commit or abort because:

  • Other participants might have voted "no" (they don't know)
  • The coordinator might have already told some participants to commit
  • Unilateral action would violate atomicity

This is like a group decision where everyone raises their hand to agree, but the meeting leader suddenly leaves the room. No one can act until the leader returns to announce the final decision—meanwhile, everyone's stuck waiting.

The Impact

If the coordinator fails, participants remain blocked until:

  • The coordinator recovers and reads its log
  • A timeout forces an abort (losing work)
  • Manual intervention occurs

This blocking can cascade across the entire distributed system, making 2PC unsuitable for systems requiring high availability during failures.

Key Takeaway: 2PC's blocking nature means coordinator failure causes all participants to wait indefinitely while holding locks, potentially bringing the entire distributed system to a halt until recovery occurs.