OpenTP1 Version 7 Operation

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

3.14.2 Transaction management using the XA resource service

The XA resource service starts or finishes management of a transaction according to the type of transaction request received from TP1/Client/J or Client .NET. It also manages transaction information in shared memory, by linking the application server XID (transaction identifier) passed from TP1/Client/J or Client .NET with the XID managed by OpenTP1. When MSDTC linkage is used, the XA resource service also manages transaction recovery information (RI). RI is created by MSDTC, and is used to recover transactions when an error occurs during transaction determination. The statuses of these transactions are recorded in an XAR file as required.

Organization of this subsection
(1) Operation of the XA resource service
(2) Managing transaction information
(3) XAR file operations

(1) Operation of the XA resource service

The following figure shows the operation of the XA resource service.

Figure 3-29 Operation of the XA resource service

[Figure]

When using the XA resource service, invalid transactions may remain in the following circumstances:

(2) Managing transaction information

The following table shows how transaction information is managed when linked with an application server based on J2EE architecture.

Table 3-31 Transaction information management (when linked with a J2EE application server)

Transaction request type Transaction information management Change in transaction status
(Normal)
Start End File I/O
Start() Y N Y None -> Active
Call() N N N No change
End() N N N Active -> Idle
Prepare() N N N Idle -> Prepared#1
Y N Idle -> None#2
Commit() N Y N Prepared -> None#3
Idle -> None#4
Rollback() N Y N Prepared -> None#3
Idle -> None#4
Recover() N N N No change
Forget() N Y N Heuristically Completed -> None

Legend:
Y: Executes processing
N: Does not execute processing

#1
When the transaction branch is read only.

#2
For two-phase commit or rollback.

#3
For one-phase commit or rollback.

The following table shows how transaction information is managed when linked with a .NET Framework application.

Table 3-32 Transaction information management (when linked with a .NET Framework application)

Transaction request type Transaction information management Change in transaction status
(Normal)
Start End File I/O
Call() Y N N None -> Active#1
N N N No change
Prepare() N N Y Active -> Idle -> Prepared
Y Y Active -> Idle -> None#2
Commit() N Y N Prepared -> None#3
Active -> Idle -> None#4
Rollback() N Y N Prepared -> None#3
Active -> Idle -> None#4
Recover() N N N No change
Forget() N Y N Heuristically Completed -> None

Legend:
Y: Executes processing.
N: Does not execute processing.

#1
For the first Call() request of the transaction.

#2
When the transaction branch is read only.

#3
For two-phase commit or rollback.

#4
For one-phase commit or rollback.

(3) XAR file operations

The XA resource service can save transaction information to an XAR file when necessary.

(a) Creating XAR files

Create XAR files using the xarinit command, and delete them using the xarrm command. Check file information for an XAR file using the xarfills command.

Two types of XAR files are required: online XAR files and backup XAR files. Both files must have the same record length and number of records, and be accessible for file I/O operations.

An online XAR file is used in normal operation, but the backup XAR file is automatically swapped in if the normal XAR file is damaged. You should store the online XAR file and the backup XAR file on different disk volumes.

An XAR file uses one record for each transaction branch. Thus, the number of records in an XAR file must be equal to or greater than the maximum number of simultaneous transaction branches (the value specified in the trn_tran_process_count operand in the transaction service definition).

(b) Specifying XAR files

Use the xarfile command in the XA resource service definition to specify the XAR files. You must have already created an XAR file that satisfies the above conditions. If you specify an XAR file that does not exist, an error results. An error also results if you specify an XAR file that contains fewer records than the value specified in the trn_tran_process_count operant in the transaction service definition.

Use the xarfile definition command with the -t online option to specify the online XAR file and the -t backup option to specify the backup XAR file. Make sure you specify both.

(c) Notes

OpenTP1 does not support XAR file duplication. Also, the XA resource service cannot manage transaction information in any of the following circumstances:

The XA resource service shuts down whenever an error occurs in both the online XAR file and the backup XAR file. To release the XA resource service from shutdown status, execute the xarrles command. For details, see 3.14.4 Action to take if an error occurs in the XAR file.

To display the status of the transactions being managed by the XA resource service, use the xarls command. Execute the xarforce command to complete any undecided transactions.