CST(52)-Two Phase Commit Protocol

The two phase commit protocol is used to synchronize updates on the different machines so that they either all fail or succeed . This is done by centralizing the decision to commit but giving each participant the right of veto.

Mechanics of the Two phase commit protocol :

1. In the first phase of the commit , the root node or transaction co ordination sends a “prepare to commit” commands to all the sub ordinate nodes that were directly asked participate in the tranascation.

2. The first phase of the commit terminates when the root node receives “ready to commit” signals from all its direct sub ordinate nodes that participate in the transaction. This means that the transaction that has executed successfully so far on all nodes and they are now ready to do a final commit.

3. The second phase of the commit starts after the root node makes the decision to commit the transaction based on the unanimous yes vote. It tells its subordinates to commit.

4. The second phase of the commit terminates when all the nodes involved have safely commited their part of the transaction and made it durable. The root receives all the confirmation and can tell its client that the transaction completed. It can then relax until the next transaction.

5. The two phase commit aborts if any of the participants return a refuse indication , meaning that their part of the transactions failed.
CST(52)-Two Phase Commit Protocol Reviewed by 1000sourcecodes on 21:41 Rating: 5
Powered by Blogger.