Two-phase commit (2PC) ensures all-or-nothing across multiple nodes. Phase 1: coordinator asks participants to prepare (vote yes/no). Phase 2: if all vote yes, coordinator commits; otherwise aborts. The weakness: if the coordinator crashes after prepare, participants are stuck waiting. Sagas offer an alternative: execute steps with compensating actions for rollback.
If the coordinator crashes after sending prepare but before sending commit/abort, participants that voted yes are blocked. They cannot commit (the coordinator might abort) or abort (the coordinator might commit). They must wait. This is why 2PC is called a blocking protocol. Three-phase commit (3PC) adds a pre-commit phase to reduce blocking, but is more complex and still not partition-tolerant.
Saga pattern
A saga splits a distributed transaction into a sequence of local transactions. Each step has a compensating transaction that undoes its effects. If step 3 fails, run compensations for steps 2 and 1 in reverse. No coordinator lock. No blocking. The tradeoff: intermediate states are visible (no isolation).