Backend & systems·Transactions and isolation
you ask both databases to prepare, wait for both to say yes, and only then tell both to commit.
Two-phase commit
Also called2PC, XA
A protocol for making one transaction span multiple resources: a prepare round, then a commit round once all participants agree. It gives atomicity across systems and takes availability in exchange — if the coordinator dies between phases, participants sit blocked holding locks. This is why distributed systems mostly prefer sagas to 2PC.