Hi, DBA here, and yes, the handle is a cry for help. Let me explain why two-phase commit (2PC) has a reputation.
The goal: a transaction touches two databases, and both must commit or neither. A coordinator drives it.
Phase 1 (prepare) Coordinator -> A, B : "can you commit?"
A, B write PREPARED to their logs, keep locks, answer YES/NO
Phase 2 (commit) If all YES: Coordinator logs COMMIT, tells A and B to commit
If any NO or timeout: Coordinator tells everyone to abort
The problem is blocking. Once a participant has voted YES, it cannot decide alone: it is in doubt. If the coordinator crashes after collecting the votes and before telling anyone, A and B must hold their locks and wait, maybe for a long time. No safe unilateral choice exists, because the coordinator may already have told the other one to commit.
Consequences in real life:
- Locks held by in-doubt transactions stall everything that touches those rows. In PostgreSQL you will see them in
pg_prepared_xacts, and an abandoned prepared transaction also holds back cleanup. - 2PC across services over a slow network multiplies latency: two round trips plus forced log writes at every participant.
Alternatives, each with trade-offs: sagas (a sequence of local transactions with compensating actions, no atomicity but eventual consistency you design for), or replicating the coordinator's decision with a consensus protocol so it does not die alone ("Paxos commit"). Pick on purpose.
It is not you. It is the failure model. Commitment issues are inherent to the protocol.