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)?
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?
In 2PC, what are the set of actions committed by a participant that can be used to create a participant program?
Don’t include the daemon process that executes in the participant
In 2PC, the participant executes a daemon process in the background in addition to its core procedure. What are the set of actions executed by this separate process?
Run the following in an infinite loop:
In 2PC, if a participant does not receive a commit or abort decision from the _______, within a ________ period of time, then it may learn the decision from another ________
coordinator
bounded
participant
In 2PC, when a participant P tries to learn the decision (or commit or abort) from another participant Q, what are the set of actions that P would make based on Q’s state being:
note that Q is the remote participant, whereas P is the local participant
Note: whenever all participants are in state READY and they are asking around to see what the decision should be, the system will wait forever
In 2PC, if the coordinator crashes, is a participant able to make progress?
How would the participant know what the decision should be to make progress on?
Yes the participant can make progress.
The participant would have to have received the decision from the coordinator despite the crash, or learn the decision from other participants
In 2PC, Following a coordinator crashing, under what condition is it safe for a transaction to be committed?
If all participants voted to commit (all are in READY or COMMIT state), then it is safe to commit
In 2PC, Following a coordinator crashing, under what condition is it safe for a transaction to be aborted?
If ANY of the participants are not in the COMMIT or READY state, then it is safe to abort
In 2PC, what happens if both a coordinator and a participant crash?
A smarter implementation of 2PC is needed (outside the scope of this course)
Generally, the coordinator or the participant needs to wait for the other party to recover, reload its logs, and continue
What is a distributed checkpoint?
A collection of checkpoints taken by numerous processes.
Allows inter-process communication and coordination