The two-phase commit protocol

The two-phase sync point protocol consists of two requests issued by the sync point manager to each of the resource managers involved in the UOR. Each of the UOR states, in-flight and in-doubt, define what happens to the UOR in the event of a thread failure.

Phase 1
The sync point manager asks all participants if they are ready to commit a UOR.
Phase 2
The sync point manager tells each participant to commit or abort based on the response to the request issued in phase 1.

A UOR has two states: in-flight and in-doubt. The UOR is in an in-flight state from its creation time until the time IMS DB logs the phase 1 end (point C in the following two tables). The UOR is in an in-doubt state from (point C) until IMS DB logs phase 2 (point D in the following two tables).

The in-doubt state for a single-phase sync point request is a momentary state between points C and D in Table 1.

The in-flight and in-doubt states are important because they define what happens to the UOR in the event of a thread failure. If a thread fails while its IMS DB UOR is in-flight the UOR database changes are backed out. If a thread fails when its IMS DB UOR is in-doubt, during single-phase commit, the UOR database changes are kept for an individual thread abend, but are not kept for a system abend. If a thread fails when its IMS DB UOR is in-doubt during two-phase commit, the database changes are kept.

Thread failure refers to either of these cases:

The following code shows the system events that occur when CCTL is used for single-phase sync point processing.

Time →
–––A–––B––––––C–––D–––E––––

Table 1. CCTL single-phase sync point processing
Points In Time System Events
A CCTL phase 1 send
B IMS DB phase 1 receive
C IMS DB log phase 1 end
D IMS DB log phase 2
E CCTL phase 2 receive

The following table shows the system events that occur when CCTL is used for two-phase sync point processing.

Time →
–––A–––B–––––C–––D–––E–––––––––––F–––G––––H––––––J–––K––––––––

Table 2. CCTL two-phase sync point processing
Points in time System events
A CCTL phase 1 send
B IMS DB phase 1 receive
C IMS DB log phase 1 end
D IMS DB phase 1 respond
E CCTL phase 1 receive
F CCTL phase 2 send
G IMS DB phase 2 receive
H IMS DB log phase 2
J IMS DB phase 2 respond
K CCTL phase 2 receive

The following figure shows the system events that occur when two-phase sync point processing is completed using ODBA.

Figure 1. ODBA two-phase sync point processing
begin figure description - This figure is described in the surrounding text. end figure description.
Note:
  1. The ODBA application and IMS DB make a connection using the ODBA interface.
  2. IMS expresses protected interest in the work started by the ODBA application. This informsz/OS Resource Recovery Services that IMS will participate in the two-phase commit process.
  3. The ODBA application makes a read request to an IMS resource.
  4. The ODBA application updates a protected resource.
  5. Control is returned to the ODBA application following its update request.
  6. The ODBA application requests that the update be made permanent by issuing the SRRCMIT call.
  7. RRS calls IMS to do the prepare (phase 1) process.
  8. IMS returns to RRS with its vote to commit.
  9. RRS calls IMS to do the commit (phase 2) process.
  10. IMS informs RRS that it has completed phase 2.
  11. Control is returned to the ODBA application following its commit request.