Distributed Systems also: 2PC

Two-phase commit

Coordinator-driven atomic commit across N participants.


In plain terms

Prepare → commit. Blocking: if the coordinator dies after prepare, participants are stuck. Saga and Calvin are alternatives.

Origin

Jim Gray, 1978 ("Notes on Data Base Operating Systems"). The classical atomic-commit protocol; blocking on coordinator failure is its known weakness.

Where it shows up in production
  • XA transactions Distributed transactions across heterogeneous resource managers (databases, queues) standardised in X/Open XA.
  • MongoDB sharded transactions Uses a coordinator-based 2PC across shard primaries.
  • Spanner Combines Paxos with 2PC for multi-shard transactions, surviving coordinator failure via Paxos-replicated state.
Sources & further reading
Found this useful?