TOPICS (Click to Navigate)

Pages

Saturday, July 19, 2014

Two Phase Commit Protocol in Pictures

Two Phase Commit Protocol in Pictorial Representation / Pictorial Representation of 2PC Protocol / Easy understanding of 2PC through Pictures / What is 2PC Protocol is all about? / Explain the steps involved in Two Phase Commit Protocol 



Two Phase Commit (2PC) protocol commits the transaction if all are ready to commit. See steps 1 to 4 below;

Step 1
Step 1 - Transaction Coordinator for Transaction T sends <prepare T> message


Step 2
Step 2 - Transaction Managers of all the participating sites recording their stand <ready T> for T and send <ready T> to TC


Step 3
Step 3 - If all sites are ready, then TC writes and sends <commit T> message to all the participating sites


Step 4
Step 4 - The participating sites recording and executing the decision of TC on Transaction T

Two Phase Commit (2PC) protocol aborts the transaction, if any of the participating sites are not ready for a commit. See steps 1 to 4 given below;

Step 1
Step 1 - Transaction Coordinator for Transaction T sends <prepare T> message


Step 2
Step 2 - One of the sites is not ready to commit. Hence, it writes <no T> to log and sends <abort T> to TC


Step 3
Step 3 - As one of the sites is not ready for commit, TC decides to abort and includes <abort T> to log and sends <abort T> to all the TMs


Step 4
Step 4 - Participating sites records and executes the decision of TC to abort T