Home
ArenaGraphSignalTopics
/Distributed Systems Architecture
Chapter 7 • Module 2 5 min breakdown +15 XP Module

Three-Phase Commit (3PC) and Its Practical Limitations

From Track:Distributed Systems ArchitectureDistributed Systems & Consensus

In 1981, Dale Skeen published a groundbreaking paper designed to fix the fundamental limitation of Two-Phase Commit: The Three-Phase Commit (3PC) Protocol.

Skeen observed that 2PC blocks because cohorts in the PREPARED state cannot distinguish whether the coordinator died before or after making a commit decision.

By introducing an intermediate PreCommit phase, 3PC creates a non-blocking commit protocol for crash-stop failure models.

However, as we will discover, 3PC has a fatal vulnerability in real-world asynchronous networks with network partitions, which is why modern distributed databases use Paxos/Raft instead of 3PC.

Interactive Blueprint
Rendering diagram...

1. How Three-Phase Commit Works

3PC splits the commit process into three non-blocking phases:

text
Loading code editor...

2. Why 3PC is Non-Blocking Under Crash-Stop

What happens if the Coordinator crashes during 3PC?

text
Loading code editor...

In a pure Synchronous / Fail-Stop environment (where servers crash cleanly and network latency is strictly bounded by a known constant ), 3PC completely eliminates the indefinite blocking problem of 2PC!


3. The Fatal Flaw of 3PC: Network Partitions (Split-Brain)

Why does almost no production distributed database (Google Spanner, CockroachDB, PostgreSQL, TiDB) use 3PC today?

Because real-world networks are asynchronous and prone to network partitions.

When a network partition occurs during 3PC, the protocol can cause catastrophic state divergence (Split-Brain):

Interactive Blueprint
Rendering diagram...

The Scenario Explained:

  1. Coordinator sends CanCommit? to all nodes. All vote YES.
  2. Coordinator sends PreCommit to Cohort 1, but a network partition drops the packets to Cohorts 2 and 3.
  3. Partition A (Coordinator + Cohort 1): Both are in PreCommit, so they advance and COMMIT the transaction.
  4. Partition B (Cohorts 2 and 3): They timed out in CanCommit without receiving PreCommit. Following 3PC rules, they elect a new coordinator and ABORT the transaction.
  5. Outcome: The database is now permanently corrupted with inconsistent data on opposite sides of the network.

4. 2PC vs 3PC vs Raft/Paxos: The Architectural Comparison

text
Loading code editor...

Why Consensus Replaced 3PC:

Modern distributed transactional databases (CockroachDB, YugabyteDB, Google Spanner) solve atomic commitment by pairing Two-Phase Commit with Raft/Paxos consensus:

  • Instead of a single coordinator, the transaction record itself is replicated to a Raft consensus group.
  • If the leader dies, Raft elects a new leader within who resumes the 2PC state without blocking or splitting.

5. Chapter Summary & 3PC Invariants

text
Loading code editor...
Milestone Verification

Ready for the next lesson?

Mark this module complete to record verified progress and earn +15 XP toward your architect profile.