Talk:Two-phase commit protocol

From Wikipedia, the free encyclopedia

[edit] Merged in Two-phase commit

I just merged in the content from Two-phase commit. There was almost 100% overlap in content, though there were differences in terminology and formatting. I hope you all like the result. Jamie 01:12, 14 November 2005 (UTC)



The following paragraph in "Disadvantages" is incorrect and needs to be removed:

"Another disadvantage is the protocol is conservative. It is biased to the abort case rather than the complete case. Also it cannot recover from cases where a node has failed in the commit stage (due to internal or network failures) after indicating that it is ready to commit. In this case, resources that committed prior to this failure cannot be rolled back."

First, it can be biased either to commit or abort (see literature). Also, all known commercial implementations recover correctly (to abort) if such faliure occures. No resource commits before completion (decision by coordinator)


How can it be that "all known commercial implementations recover correctly (to abort) if such faliure occures [sic]?" At some point the coordinator must start calling the FINAL commits on all the participants, either all at once or one-at-a-time (same thing). If one of the partipants fails the final commit, won't the data be left in an inconsistent state? This is what the "resources that committed prior to this failure cannot be rolled back" is suggesting.

I believe this is a MAJOR question (really, "is 'two-phase commit' a magic bullet?") and even IF it is true that "all known commerical implementations recover correctly," I think that this magical point should be included in the article somehow. --Daniel Rosenstark 01:24, 12 June 2006 (UTC)


As per earlier comments, I wonder if more discussion could be given in the "Disadvantages" paragraph regarding what it actually means to be biased towards aborts rather than towards commits. Nels Beckman 19:11, 6 September 2006 (UTC)


I just modified the section on disadvantages, since it contained some mistakes. 1. The usual 2PC uses a timeout to avoid that the coordinator blocks forever. This is the reason why the protocol is biased towards aborts. 2. I removed the passage "Also it cannot recover from cases where a node has failed in the commit stage (due to internal or network failures) after indicating that it is ready to commit. In this case, resources that committed prior to this failure cannot be rolled back." This will never occur if the protocol is implemented properly: A cohort will only vote for commit if it can guarantee successful completion, even in the case of a failure. So, prior to voting for commit the cohort will log the necessary information for transaction redo. In addition, each cohort will keep the undo log until it has received the final decision by the coordinator. So, A cohort will never reveive an abort message without beeing prepared to abort.


I don't see how this addresses the root issue. If a cohort has committed, and then later another cohort fails to commit, you can't undo the finalized commitment. You seem to be suggesting that the commitment isn't finalized until everyone has committed. That's a contradiction of terms. A commitment, by definition, is finalized. This isn't just a semantic argument. What you are suggesting is really just taking the problem out one level. If the commitment isn't yet finalized (whatever that means) then what happens if there's a failure in the 'finalization of the commitment'? You could have a finalization of the finalization of the commitment but then a failure could happen there so you'd need a finalization of the finalization of the finalization of the commitment. This is like repeatedly traveling halfway to your destination. You keep getting closer but you'll never get there.

And undoing a committed change is also unworkable. Once committed, the change is visible to other transactions. This violates the whole concept of committing transactions.

Unless someone can show some external documentation, I remain convinced that the two phase commit cannot recover reliably from a failure in the commit phase. Dubwai 21:11, 25 January 2007 (UTC)