Module 10c - Distributed Commit and Checkpoints Flashcards
ACID is a collection of properties that we expect in a database. What does ACID stand for? What does each letter mean?
Atomicity - All the updates take effect or none of them do
Consistency - Constraints are preserved
Isolation - Concurrent transactions are unaware of each other
Durability - Updates made by committed transactions are not lost in the event of a failure
The distributed commit problem concerns transaction _______ in a ________ environment
atomicity
distributed
Achieving atomicity is easy in a centralized database, but it is harder in a distributed database. Why?
Different components of the database could fail independently during a transaction. that makes it difficult to make sure that updates took place at either all of them or none of them
The coordinator is a _______ node which is responsible for ensuring ________
separate/independent
atomicity
In a distributed database system, transaction commitment is initiated by a _________ after the transaction _________ phase, during which each _________ discovers whether they are able to commit the transaction or not
coordinator
execution
participant
How do participants communicate to the coordinator on whether they should commit or abort a transaction?
The coordinator asks each participant for a vote on whether they should commit or abort the transaction globally
What happens after the coordinator collects the votes from the participants?
The coordinator computes the global decision after collecting votes, and then shares the decision with the participants
What must happen to the transaction if ANY of the participants vote to abort?
The transaction must abort globally whenever ANY participant votes to abort
If there are no failures in the system, and every participant votes to commit, what must happen?
The transaction must commit globally whenever all participants vote to commit
Two-phase commit (2PC) is a common solution based on two phases.
What happens during phase 1 of 2PC?
Phase 1:
Coordinator asks participants whether they are ready to commit. Participants respond with votes
Two-phase commit (2PC) is a common solution based on two phases.
What happens during phase 2 of 2PC?
Phase 2:
Coordinator examines votes and decides the outcome of the transaction. If all participants vote to commit, then the transaction is committed successfully.
Otherwise it is aborted
What are the 4 assumptions made with Two-phase commit (2PC)?
- Synchronous processes (can be executed without interruption from start to finish)
- Bounded communication delays
- Crash-recovery failures
- Processes have access to stable storage for logging recovery information
What does the state transition diagram look like for the <strong>coordinator</strong> in Two-Phase commit (2PC)?
https://media.discordapp.net/attachments/213179086351106048/1003046928721924207/unknown.png
What does the state transition diagram look like for the <strong>participant</strong> in Two-Phase commit (2PC)?
https://media.discordapp.net/attachments/213179086351106048/1003047663886929960/unknown.png
In 2PC, what are the set of actions committed by a coordinator that can be used to create a coordinator program?
- multicast “vote request” to all participants
- listen in on all the votes from all the participants, record all the incoming votes.
- If a timeout has been invoked, multicast “global abort” to all participants, and exit the program/process
- If all participants sent “vote commit” to the coordinator AND the coordinator votes “commit”, then multicast “global commit” to all participants
- Else (if #4 is not true), multicast “global abort” to all participants