























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concepts of distributed transactions, focusing on the two-phase commit (2pc) protocol and edge chasing for deadlock detection. The 2pc protocol ensures atomicity in distributed transactions by collecting commit or abort votes from all participants and making a collective decision. Edge chasing is a method for detecting deadlocks in distributed systems by forwarding probes along the edges of the wait-for graph until a cycle is found.
Typology: Study notes
1 / 31
This page cannot be seen from the preview
Don't miss anything!
























Coordination in Distributed Transactions
Each server has a special participant process.
Coordinator process (leader) resides in one of the servers, talks to trans. & participants.
T
A
Y
Z
B
C
D
X
join
join
join
Coordinator (^) Participant
Participant
Participant
T
Open^ Coordinator Transaction TID Close Transaction Abort Transaction
A Participant
a.method (TID )
1
2
Join (TID, ref)
3
Coordinator & Participants The Coordination Process
..
BranchZ
BranchX
participant
participant
C D
Client
BranchY
B
A
join participant
join
join
T
a.withdraw(4);
c.deposit(4);
b.withdraw(3);
d.deposit(3);
openTransaction
b.withdraw(T, 3);
closeTransaction
T = openTransaction a.withdraw(4); c.deposit(4); b.withdraw(3); d.deposit(3); closeTransaction
Note: the coordinator is in one of the servers, e.g. BranchX
Doesn’t work when a participant crashes before receiving this message (partial transaction results are lost).
Does not allow participant to abort the transaction, e.g., under deadlock.
In a two-phase protocol
participant (which stores partial results in permanent storage).
commit message
all participants
canCommit?(trans)-> Yes / No Call from coordinator to participant to ask whether it can commit a transaction. Participant replies with its vote. doCommit(trans) Call from coordinator to participant to tell participant to commit its part of a transaction. doAbort(trans) Call from coordinator to participant to tell participant to abort its part of a transaction.
haveCommitted(trans, participant) Call from participant to coordinator to confirm that it has committed the transaction. getDecision(trans) -> Yes / No Call from participant to coordinator to ask for the decision on a transaction after it has voted Yes but has still had no reply after some delay. Used to recover from server crash or delayed messages.
Communication in Two-Phase Commit Protocol
canCommit?
Yes doCommit
haveCommitted
Coordinator status
(waiting for votes)
3 committed done
1 prepared to commit
Participant status
(uncertain)
2 prepared to commit
4 committed
replying yes/no in first phase. Retrievable after crash recovery.
eventually abort)
(pessimistic!). It must annouce doAbort to those who sent in their votes.
reply received) – cannot abort after having voted Yes but before receiving doCommit/doAbort!
Two Phase Commit (2PC) Protocol
Coordinator (^) Participant
Execute
Uncertain
Commit
Abort
Execute
Abort
canCommint? request not ready ready
All YES
Timeout or a NO
Commit
Abort
COMMIT decision
CloseTrans()
ABORT decision
Servers forward “probe” messages to servers in the edges of wait -for graph, pushing the graph forward, until cycle is found.
Distributed Deadlocks
V
Held by
W
Held by Waits for
Waits for
Waits for Deadlock detected
U
C A
B
Initiation
Z
Y
X
W
V
Held by
W
Held by Waits for
Waits for
Waits for Deadlock detected
U
C A
B
Initiation
Z
Y
X
W
Example 2PC in Nested Transactions
T
T
T
T
T
T
T
A
B
C
D
F
H
K
T
T
T
T
T
T
T
Nested Distributed Transaction
Abort No
Provisional^ Yes
Provisional Yes
Provisional Yes
Yes
Yes
Provisional
Abort^ No
Bottom up decision in 2PC