Product Environment 9-25
Two-Phase Commit and Automatic Recovery
If the coordinator is unable to contact one or more of the participants, or ifexecutionerrors are detected, messages are recorded in the OnLine messagelog.The coordinator continues its attempts to contact all participants and tocomplete the protocol.
Figure9-6
Simple
illustration of
automatic
coordinator
recovery. See text
onpage 9-24.
All Participants:
Return message: “can commit.”
P3 Participant:
Reports status: “unknown status.”
Coordinator:
Sends a “prepare” message to participants.
P1 and P2 Participants:
Report status: “can commit.”
Coordinator:
Records decision to commit transaction.
Coordinator fails.
Start Protocol
End
Start Coordinator Recovery
AfterOnLine returns online, tbinit forks a new coordinator database server process.
Coordinator:
Queries each participant for transaction status.
Coordinator:
Sends“commit” messages to P1 and P2. P3 is assumed to have committe
P1 and P2 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 responses.
Records transaction committed.
Removes transaction entry from shared-memory transaction table.
Releases shared-memory resources.
C
P1 P2 P3
C
P1 P2 P3
C
C
P1 P2
C