Scalable Database Server, HiRDB Version 8 Description

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

6.9.4 Commit and rollback

The process of placing into effect in the database the updates made by a transaction is called commit. The process of invalidating the updates made by a transaction is called rollback. When commit and rollback occur is determined as follows:

Each of these types of commit and rollback timing is explained as follows.

Organization of this subsection
(1) Commit timing
(2) Rollback timing
(3) Commitment control on a HiRDB/Parallel Server

(1) Commit timing

This section explains commit timing.

Timing defined by an SQL
The COMMIT control SQL statement can be specified to commit a transaction whenever a COMMIT statement is executed.

Commit set automatically by HiRDB
  • Commit is performed automatically by HiRDB when a definition SQL or PURGE TABLE statement is executed.
  • Commit is performed automatically by HiRDB when a UAP terminates.

(2) Rollback timing

This section explains rollback timing.

Timing defined by an SQL
The ROLLBACK control SQL statement can be specified to roll back the process to the previous commit point whenever a ROLLBACK statement is executed.

Rollback set automatically by HiRDB
  • If a process cannot continue during SQL execution, HiRDB will roll back the process implicitly to the previous commit point.
  • If a UAP terminates abnormally, HiRDB will roll back the process to the previous commit point.

(3) Commitment control on a HiRDB/Parallel Server

A HiRDB/Parallel Server provides the following two methods of commitment control:

(a) One-phase commit

With one-phase commit, only commit processing is performed, rather than both prepare processing and commit processing (which is the case with two-phase commitment control). This means that the number of communication transactions for synchronization point processing between the front-end server and the back-end server (dictionary server) is the number of branches [Figure] 2 (whereas, with two-phase commit, it is the number of branches [Figure] 4), which improves transaction processing performance. To use one-phase commit, specify ONEPHASE (default) in the pd_trn_commit_optimize operand.

One-phase commit is used only when one branch within a single transaction is being updated. Otherwise, two-phase commit must be used.

Figure 6-22 shows the processing for one-phase commit.

Figure 6-22 Processing for one-phase commit

[Figure]

The process of executing one-phase commit for commitment control is called one-phase optimization.

(b) Two-phase commit

Two-phase commit performs synchronization point processing of the transaction by separating commitment control into two phases, prepare processing and commit processing. The number of communication transactions for synchronization point processing between the front-end server and the back-end server (dictionary server) is the number of branches [Figure] 4. Figure 6-23 shows the processing for two-phase commit.

Figure 6-23 Processing for two-phase commit

[Figure]

The type of commitment control used on a HiRDB/Parallel Server is determined by the issuer of the commit and the execution environment of the transaction. Table 6-11 shows how commitment control is determined on a HiRDB/Parallel Server.

Table 6-11 Commitment control on a HiRDB/Parallel Server

Condition HiRDB commitment control
Issuer of the commit Commitment control indicated by the commit issuer Execution environment of the transaction
UAP [Figure] For a reference transaction One-phase commit
If one server is updated by the transaction and ONEPHASE is specified (or nothing is specified) in the pd_trn_commit_optimize operand
Other than the above Two-phase commit
OLTP system One-phase commit For a reference transaction One-phase commit
If one server is updated by the transaction and ONEPHASE is specified (or nothing is specified) in the pd_trn_commit_optimize operand
Other than the above Two-phase commit
Two-phase commit For a reference transactions One-phase commit
Other than the above Two-phase commit

[Figure]: Not applicable