We now examine in detail how 2PC responds to various types of failures. As we shall see, one major disadvantage of the 2PC protocol is that coordinator failire may result in blocking, where a decision either to commit or to abort T may have to be postponed untul Ci recovers.
1.Failure of a Participating Site
When a participating site Sk recovers from a failure, it must examine its log to determine the fate of those transactions that were in the midst of execution when the failure occureed. Let T be one suck transaction. We consider each of the possible cases:
The log contains a
The log contains an
The log contains a
The log contains no control records (abort, commit, ready) concerning T. Theabsence of control records implies that Sk failed before responding to the prepare T message from Ci. Since the failure of Sk precludes the sending of suck a response, by our olgorithm Ci must abotrt T. hence, Sk must execute undo(T).
2.Failure of the Coordinator
If the coordinator fails in the midst of the execution of the commit protocol for transaction T, then the participating sites must decide on the fate of T. we shall see that, in certain cases, the participating sites cannot decide whether to commit or abort T, and therefore it is necessary for these sites to wait for the recovery of the failed coordinator.
If an active site contains a
If an active site contains a
If some active site does not contain a
If none of the preceding cases holds, then all active sites must have a
3.Failure of the Network
When alink fails, all the messages that are in the process of being routed through the link do not arrive at their destination intact. From the viewpoint of the sites connected throughout that link, it appears that the other sites have failed. Thus, our previous schemes apply here as well.
When a number of links fail, the network may partition. In this case, two possibilities exist. The coordinator and all its participant may remain in one partition: in this case, the failure has on effect on the commit protocol. Alternatively, the coordinator and its participants may belong to several partitions:in this case, message between the participant and the coordinator are lost, reducing the case a link failure, as discussed.