Maintaining ACID transactions across a single relational database engine is well-understood: the local lock manager and write-ahead log (WAL) guarantee atomicity and isolation. But when data is partitioned across multiple independent databases, payment gateways, and third-party fulfillment services, single-node ACID guarantees disappear.
This module deconstructs the algorithms for coordinating distributed atomic commitments:
- Two-Phase Commit (2PC): Phase 1 (Prepare/Vote) and Phase 2 (Commit/Abort), the X/Open XA standard, and the fatal Coordinator Blocking Problem.
- Three-Phase Commit (3PC): Can-Commit, Pre-Commit, and Do-Commit protocols, and why 3PC assumes synchronous network bounds that fail in real-world partitioned environments.
- Sagas & Compensating Transactions: Replacing distributed locks with eventual consistency. Comparing decentralized event choreography against centralized state-machine orchestration (Temporal / AWS Step Functions).
- Try-Confirm-Cancel (TCC): Reserving resources in two phases (e.g. frozen funds, held inventory) to achieve atomic multi-system commitments without holding database locks.