Professional Documents
Culture Documents
Transactions
Outline
• Distributed Transactions
– Flat and Nested
– Atomic
– Two phase Commit protocol
– Concurrency Control
requests to more
than one server
T
• Transaction T is a T
Y
servers X, Y and Z.
T = openTransaction Y
openSubTransaction T B b.withdraw(20)
2
a.withdraw(10);
openSubTransaction
b.withdraw(20); Z
openSubTransaction
c.deposit(10); T
3 C c.deposit(10)
openSubTransaction
d.deposit(20); T D d.deposit(20)
4
closeTransaction
T = openTransaction
join BranchY
a.withdraw(4);
c.deposit(4); participant
b.withdraw(3);
d.deposit(3); C c.deposit(4);
closeTransaction
D d.deposit(3);
Note: the coordinator is in one of the servers, e.g. BranchX
BranchZ
T aborted (at Y)
2
T provisional commit (at P)
22
c.withdraw(20) wait at Z
a.withdraw(20) wait at X
C D A
Z X V
Held
Waits Held by by
for U
V U
B Waits for
Held
by
Y
T
T U V T
U V
X Y
V
U
T
Waits for T Waits for T T ® U
W ® V ® T
V U V U W ® V ® T® U
V
T® U® W U
T® U® W® V
W Waits
for W ® V
Waits
W W for
W
W U® V probe
U Waits V® W queue
for C
U® V U
V Waits for
V Waits for
probe U ® V B B
queue U® V
Participant committed The participant sends a haveCommitted message to the coordinator (in
case this was not done before it failed). This will allow the coordinator
to discard information about this transaction at the next checkpoint.
Participant uncertain The participant failed before it knew the outcome of the transaction. It
cannot determine the status of the transaction until the coordinator
informs it of the decision. It will send a getDecision to the coordinator
to determine the status of the transaction. When it receives the reply it
will commit or abort accordingly.
Participant prepared The participant has not yet voted and can abort the transaction.
Coordinator done No action is required.
SCOPE, VIT Chennai