Product Environment 9-25
Two-Phase Commit and Automatic Recovery
If the coordinator is unable to contact one or more of the participants, or if
execution errors are detected, messages are recorded in the OnLine message
log. The coordinator continues its attempts to contact all participants and to
complete the protocol.
Figure 9-6
Simple
illustration of
automatic
coordinator
recovery. See text
on page 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
After OnLine returnsonline, tbinit forks anew coordinator database server process.
Coordinator:
Queries each participant for transaction status.
Coordinator:
Sends “commit” messages to P1 and P2. P3isassumedto 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