TCC: Try, Confirm, Cancel - Middle¶
Each participant stores a reservation keyed by global transaction ID and an explicit terminal state.
stateDiagram-v2
[*] --> Reserved: Try
Reserved --> Confirmed: Confirm
Reserved --> Cancelled: Cancel
Cancelled --> Cancelled: repeated Cancel
Confirmed --> Confirmed: repeated Confirm
Insert a tombstone when Cancel arrives before Try so delayed Try cannot reserve later. Handle empty Confirm explicitly. The coordinator durably records its decision and redrives Confirm or Cancel until every participant acknowledges.
Test yourself¶
- Why keep a Cancel tombstone?
- Which transitions must be idempotent?
- What does coordinator recovery redrive?
Continue to senior.md.