Two-Phase Commit — Promises, Commit Point, In Doubt

Two-Phase Commit — Promises, Commit Point, In Doubt A sequence diagram generated by Archify. begin a distributed transaction coordinator issues a global transaction ID single-node tx under the global ID single-node tx under the global ID PREPARE — can you commit? PREPARE — can you commit? YES — I promise to commit data written to disk; the right to abort is waived YES — I promise to commit COMMIT — phase 2 the decision is written to the log first — the commit point COMMIT — phase 2 (lost) the coordinator crashes before it arrives what was the decision? no reply — db1 stays in doubt and holds its locks Phase 1 — prepare and vote The commit point Phase 2 — commit, crash, in doubt Application · drives the transaction · Sequence participant Application drives the transaction Coordinator · transaction manager · Sequence participant Coordinator transaction manager Database 1 · participant · Sequence participant Database 1 participant Database 2 · participant · Sequence participant Database 2 participant Legend main request return async trace message