Problem Statement
What problem does two-phase commit (2PC) address in distributed transactions?
Explanation
2PC coordinates multiple resource managers to vote on success, then either commits all or aborts all. It preserves atomicity across systems.
It adds latency and failure modes like in-doubt transactions. Many modern designs prefer idempotent events with eventual consistency unless strict atomicity is required.
Code Solution
SolutionRead Only
-- conceptual coordinator messages: prepare -> commit
Practice Sets
This question appears in the following practice sets:
