Eighth Homework Assignment
Posted 22 Apr 2004 by herman
Due in class (on paper), Wednesday the 28th of April.
The homework covers reading material on distributed transactions: homework8.pdf.
Solution, posted 6 May 2004 by hermanThe first question is straightforward from the reading material.
To answer the second question, consider the case of a "failure" (which might just be one participant voting No to a canCommit query).
In the two-phase protocol, any participant that votes Yes must guarantee that its transaction can be committed when a doCommit request arrives. Of course, that doCommit request could never arrive --- instead, the coordinator could send a doAbort request. Thus a participant voting Yes is (1) uncertain, and (2) blocking. It is blocking because other transactions with intersecting read/write sets will have to wait for the participant to complete (either commit or abort). To see why it must be blocking, suppose all participants voted Yes, and all but one participant got the doCommit message, because the coordinator crashed before it could send that message. The waiting transaction is uncertain, and has to wait (and block) because perhaps its sister transactions at the other sites already have done their commits --- so it cannot just abort and unblock; neither can it commit, because it is uncertain.
In the three-phase protocol, no participant is allowed to be in the "committed" state if any participant is uncertain. To accomplish this, the new "preCommit" state is added. Once a participant enters the preCommit state, there is no uncertainty --- all other participants also voted Yes. Technically, this would allow the coordinator to fail sending the doCommit message and rather than being permanently blocked, the participants could do such things as elect a new coordinator, finish the transaction, and so on.