OpenTP1 Version 7 Operation

[Contents][Index][Back][Next]

3.14.3 Starting and stopping the XA resource service

Organization of this subsection
(1) Starting the XA resource service
(2) Restarting the XA resource service
(3) Terminating the XA resource service

(1) Starting the XA resource service

The XAR files are initialized when you start the XA resource service. If the XA resource service fails to start, OpenTP1 will also fail to start.

For details about the definitions required to use the XA resource service, see 3.14.1(2) Prerequisite definitions.

(2) Restarting the XA resource service

To restart the XA resource service, you must restart OpenTP1. Whether or not the XA resource service restarts with OpenTP1 depends on the status of the XA resource service the last time OpenTP1 started normally. If the XA resource service started at the last normal run, the XA resource service also restarts with OpenTP1. If not, the XA resource service does not restart.

The XAR files are initialized when you restart the XA resource service.

If the XA resource service fails to restart, OpenTP1 will also fail to restart.

When you restart OpenTP1, you can change the following definition operands and commands:

You can only change the value of the definition command xarfile at OpenTP1 restart if an error occurs in an XAR file. If you attempt to change the definition command xarfile at OpenTP1 restart in any other circumstance, you will not be able to recover transaction branches. For details about how to recover transaction branches if an error occurs in an XAR file, see 3.14.4 Action to take if an error occurs in the XAR file.

At restart, the XA resource service restores transaction branches to their previous states, using an XAR file (transaction branch recovery processing). If the backup XAR file was being used, transaction branches are recovered from the backup XAR file; otherwise, transaction branches are recovered from the online XAR file.

In transaction branch recovery processing, the XA resource service examines the prior transaction information for each record in the XAR file. An undecided transaction branch that had the first-phase status Prepared is restored to the Prepared status. Because the XAR file contains XID information for transaction branches, OpenTP1 is again able to accept instructions relating to transaction determination from the application servers linked by the XA resource service.

If a transaction branch had the status Heuristically completed, the XA resource service restores the transaction branch to the Heuristically completed status, completing the transaction branch heuristically.

All transactions that were not yet prepared (still in Active or Idle state) are rolled back. Because the XID information of these transaction branches is then deleted, subsequent determination requests received for these transaction branches from the application servers linked by the XA resource service cannot be processed.

If transaction recovery processing is performed on a completed transaction branch (a transaction branch that has been committed or rolled back), the determination result of the transaction branch remains unchanged.

The following table shows the recovery processing performed on a transaction branch according to the transaction status.

Table 3-33 Transaction branch recovery processing at OpenTP1 restart

Transaction status Processing XID information
Active Roll back Deleted
Idle Roll back Deleted
Prepared Before PJ output by OpenTP1 Wait for transaction completion Left in file
After PJ output by OpenTP1 Commit Deleted
Rollback only Roll back Deleted
Heuristically completed Heuristic completion Left in file

(3) Terminating the XA resource service

The XA resource service terminates along with OpenTP1. However, OpenTP1 cannot terminate unless all transaction branches from all application servers linked by the XA resource service have completed. If uncompleted transaction branches remain, OpenTP1 waits for completion of them. Alternatively, you can use the forced termination command provided by OpenTP1 to forcibly terminate OpenTP1 without waiting for completion of these transaction branches.