OpenTP1 Version 7 Programming Guide

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

2.3.2 Acquiring a synchronization point

The acquisition of a synchronization point means to make all transaction branches comprising a global transaction synchronized and terminated with the same result (commitment or rollback).

Organization of this subsection
(1) Using commitment functions
(2) Using rollback functions
(3) If an error occurs during synchronization point acquisition processing
(4) Action to be taken if a function for acquiring synchronization point is not called

(1) Using commitment functions

Commitment functions can be used only with the SPP or SUP (root transaction branch) that started a transaction using the function dc_trn_begin(). Note that commitment functions cannot be used with another transaction branch. The global transaction terminates normally when all transaction branches terminate normally.

(a) Commitment in chained/unchained mode

There are two types of transaction processing commitment: commitment (dc_trn_chained_commit()) in chained mode which acquires a synchronization point and consecutively starts the next transaction after one transaction terminates, and commitment (dc_trn_unchained_commit()) in unchained mode which does not start a new transaction after one transaction terminates. The figure below shows transactions in chained/unchained mode.

Figure 2-28 Transactions in chained/unchained mode

[Figure]

(2) Using rollback functions

If you want to roll back a transaction according to UAP decision, you can call a rollback request from the UAP.

(a) Rollback in chained/unchained mode

There are two rollback functions: dc_trn_chained_rollback() (chained mode) and dc_trn_unchained_rollback() (unchained mode). The rollback function of the chained mode remains in the new global transaction range even after rollback processing is executed. If the rollback function of the unchained mode is called from the root transaction branch, the rollback function is not in the global transaction range.

The rollback function of the chained mode cannot be called from the root transaction branch. The rollback function of the unchained mode can be called from any transaction branch.

If the rollback function of the unchained mode is called from a transaction branch, the transaction branch is a rollback target (rollback_only status). This information is posted to the root transaction branch. In this case, the rollback function of the unchained mode remains in the global transaction range after rollback processing is executed and before the function dc_rpc_call() returns.

The figure below shows transaction rollback.

Figure 2-29 Transaction rollback

[Figure]

(3) If an error occurs during synchronization point acquisition processing

If an error occurs during a process for acquiring transaction synchronization points, the transaction is committed when it has been completed to phase 1 of synchronization points; otherwise, it is rolled back. When one of the transaction branches within a global transaction is rolled back, the whole global transaction is rolled back.

The figure below shows transaction rollback in the case of an error occurs during synchronization point acquisition processing.

Figure 2-30 Transaction rollback if an error occurs during synchronization point acquisition processing

[Figure]

(4) Action to be taken if a function for acquiring synchronization point is not called

If a UAP which does not call a function for acquiring a synchronization point terminates abnormally, the result of the UAP synchronization point is rolled back.

If the UAP (root transaction branch) terminates with the function exit() without using a function for acquiring a synchronization point, OpenTP1 performs automatic commitment. If this commitment processing encounters an error before it reaches the end of phase 1, the global transaction is rolled back. In this case, this rollback cannot be posted to the UAP.