Recall & Review
beginner
What is a distributed transaction?
A distributed transaction is a database transaction that involves multiple networked databases or systems. It ensures all parts of the transaction either commit or rollback together, keeping data consistent across all systems.
Click to reveal answer
beginner
What does 2PC stand for and what is its purpose?
2PC stands for Two-Phase Commit. It is a protocol used to ensure all participants in a distributed transaction agree to either commit or abort the transaction, maintaining data consistency.
Click to reveal answer
intermediate
Describe the two phases of the Two-Phase Commit protocol.
Phase 1: Prepare phase - The coordinator asks all participants if they can commit. Participants respond with 'yes' or 'no'. Phase 2: Commit phase - If all say 'yes', the coordinator tells everyone to commit. If any say 'no', the coordinator tells everyone to abort.
Click to reveal answer
intermediate
Why is the Two-Phase Commit protocol important in distributed systems?
It ensures atomicity across multiple systems, meaning either all parts of the transaction succeed or none do. This prevents data inconsistency when multiple databases are involved.
Click to reveal answer
advanced
What is a potential drawback of the Two-Phase Commit protocol?
2PC can cause blocking if the coordinator crashes after participants have voted 'yes' but before sending the commit command. Participants must wait, which can delay other operations.
Click to reveal answer
What does a distributed transaction ensure?
✗ Incorrect
Distributed transactions ensure all parts either commit or rollback together to keep data consistent.
In 2PC, what happens if any participant votes 'no' during the prepare phase?
✗ Incorrect
If any participant votes 'no', the coordinator instructs all participants to abort the transaction.
Which phase of 2PC involves asking participants if they can commit?
✗ Incorrect
The prepare phase is when the coordinator asks participants if they can commit.
What problem can occur if the coordinator crashes during 2PC?
✗ Incorrect
If the coordinator crashes after participants vote 'yes', they block waiting for the commit or abort command.
Which of the following is NOT a feature of distributed transactions?
✗ Incorrect
Distributed transactions do not make single database queries faster; they focus on consistency across systems.
Explain how the Two-Phase Commit protocol works in a distributed transaction.
Think about the two steps that ensure all participants agree before finalizing.
You got /4 concepts.
What are the benefits and challenges of using distributed transactions with 2PC?
Consider both what 2PC solves and what problems it might cause.
You got /4 concepts.