Distributed Transaction Vocabulary
1. In two-phase commit (2PC), the node that initiates the transaction, sends prepare messages to all participants, and then issues the final commit or abort decision is called the:
2. A monitoring alert fires: 'The coordinator timed out waiting for a prepare response from the payments service.' What action must the coordinator take in 2PC when this happens?
3. An order service, an inventory service, and a payment service each have their own database. To ensure atomicity across services — either all steps succeed or all are undone — without using 2PC, the team uses a sequence of local transactions with compensating rollback steps for each. What pattern is this?
4. Each service in a saga receives an event, performs a local transaction, and publishes a success or failure event for the next step to consume. There is no central orchestrator. What saga coordination style is this?
5. A system design document states: 'We use the Saga pattern as an alternative to 2PC to achieve atomicity across services.' What is the key trade-off the team is accepting by choosing Saga over 2PC?
Vocabulary Reference
| Term | Meaning |
|---|---|
| two-phase commit (2PC) | A distributed protocol with a prepare phase (all participants vote yes/no) and a commit phase (all commit or all abort). Provides strict atomicity but can block if the coordinator crashes. |
| coordinator | The node that drives 2PC: sends prepare, collects votes, issues the final commit or abort. |
| participant | A node that receives prepare from the coordinator, locks resources, votes yes or no, then awaits the commit/abort decision. |
| the coordinator timed out | A 2PC failure condition where the coordinator receives no prepare response from a participant; the coordinator must abort the transaction. |
| saga pattern | A sequence of local transactions across services, each with a compensating transaction that undoes its effect if a later step fails — an alternative to 2PC for atomicity across services. |
| atomicity across services | The guarantee that a multi-service operation either fully succeeds or is fully undone — achieved by 2PC (strict) or the Saga pattern (eventual). |
Exercise complete!
out of 5 questions