Product Environment 9-21
IBM Informix STAR and Two-Phase Commit Protocol
Example Transaction Commit
Figure9-4 is a simple representation of a two-phase commit protocol that
results in a transaction being committed. Notice that the coordinator’s
decision to commit or roll back the transaction is stored on stable storage
beforethe decision is propagated to the participants. This is done to facilitate
recovery.If a failure occurs during the operation, the recordof the decision is
needed during recovery to indicate the status of the transaction. The
beginning of phase two is considered to be the instant at which the coordi-
nator records its decision—in this case, when the commit work logical log
record is written to disk.
Figure9-4
Simple illustration
of a two-phase
commit protocol
that results in a
committed
transaction
All Participants:
Determine that the commit can occur. Record the fact that a commit
can occur. Return message: “can commit.”
Coordinator:
Waits to receive “committed” responses.
Records that the transaction is committed.
Removes transaction entry from shared-memory transaction table.
Releases shared-memory resources.
Coordinator:
Records decision to begin precommit phase. Sends a “prepare”
message to participants.
All Participants:
Commit the piece of work.
Remove transaction entry from shared-memory transaction table.
Release shared-memory resources.
Return confirmation message: “committed.”
Coordinator:
Waits to receive “can commit” responses.
Records decision to commit transaction.
Phase 2 Begins:
Sends a “commit” message to participants.
Start Protocol
End Protocol
C
PPP
C
C
PPP