IBM 000-8697 Server User Manual


 
Product Environment 9-47
Two-Phase Commit and Logical Log Records
The coordinator’s commit work record (COMMIT record) contains all infor-
mation needed to initiate the two-phase commit protocol and it serves as the
starting point for automatic recovery in the event of a failure on the coordi-
nator’s host machine. Because this record is critical to recovery, it is not
allowed to remain in the logical log buffer. The coordinator must immedi-
ately flush the COMMIT logical log record.
The participants in Figure 9-10 must immediately flush both the PREPARE
and the COMMIT logical log records. Flushing the PREPARE record ensures
that, if the participant’s host machine fails, fast recovery is able to determine
that this participant is part of a global transaction. As part of recovery, the
participant might query the coordinator to learn the final disposition of this
transaction.
Flushing the participant’s COMMIT record ensures that, if the participant’s
host machine fails, the participant has a record of what action it took
regarding the transaction. To understand why this is crucial, consider the
situation in which a participant crashes after the PREPARE record is written
but before the COMMIT record flushes. After fast recovery, the PREPARE
record is restored but the COMMIT record is lost (since it was in the logical log
buffer at the time of the failure). The existence of the PREPARE record would
initiate a query to the coordinator about the transaction. However, the coordi-
nator would know nothing of the transaction since it ended the transaction
after it received the participant’s acknowledgment that the commit occurred.
In this situation, the participant would interpret the lack of information as a
final direction to roll back the transaction. The two-phase commit protocol
requires the participant COMMIT record to be flushed immediately to prevent
this kind of misunderstanding.