Two-phase Commit
Created: 2022-01-20T17:22:06-06:00
Return to the Index
This card pertains to a resource available on the internet.
System for first requesting changes be staged on one or more storage depots and then flipping those changes to be live after the data is secured.
Requires write ahead, undo/redo logs, need to handle acknowledgements going stale (ex. network partitions or crashes.)
Stage transaction
- Coordinator sends query to commit to all affected parties
- Coordinator waits until all parties respond
- Parties perform their component (writing undo/redo and write ahead logs)
- Parties inform coordinator if writing succeeded
- If any party failed coordinator issues abort to everyone
Commit transaction
- Coordinator sends commit to all affected parties
- Parties make the transaction changes permanent
- Parties send completion notice to coordinator
Abort transaction
- Coordinator sends abort to all affected parties
- Parties dump the staged transaction
- Parties send completion notice to coordinator