0
0
DBMS Theoryknowledge~5 mins

Distributed transactions and 2PC in DBMS Theory - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AAll parts commit or rollback together
BOnly one database is updated
CTransactions run faster
DData is duplicated
In 2PC, what happens if any participant votes 'no' during the prepare phase?
AThe transaction commits anyway
BThe coordinator tells all to abort
CThe coordinator retries the prepare phase
DThe participant is removed
Which phase of 2PC involves asking participants if they can commit?
APrepare phase
BValidation phase
CExecution phase
DCommit phase
What problem can occur if the coordinator crashes during 2PC?
ATransaction is automatically aborted
BParticipants commit immediately
CParticipants block and wait
DNo effect on the transaction
Which of the following is NOT a feature of distributed transactions?
ACoordination between databases
BData consistency
CAtomicity across multiple systems
DFaster single database queries
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.