CLUSTER_TXN_SCOPE configuration parameter
Set the CLUSTER_TXN_SCOPE configuration parameter to configure your high-availability cluster so that when a client session issues a commit, the server blocks the session until the transaction is applied in that session, on a secondary server, or across the cluster.
- onconfig.std value
- CLUSTER_TXN_SCOPE SERVER
- values
SESSION
= When a client session issues a commit, the database server blocks the session until the effects of the transaction commit are returned to that session. After control is returned to the session, other sessions at the same database server or on other database servers in the cluster might be unaware of the transaction commit and the transaction's effects.SERVER
(default behavior) = When a client session issues a commit, the database server blocks the session until the transaction is applied at the database server from which the client session issued the commit. Other sessions at that database server are aware of the transaction commit and the transaction's effects. Sessions at other database servers in the cluster might be unaware of the transaction's commit and its effects. This behavior is default for high-availability cluster servers.CLUSTER
= When a client session issues a commit, the database server blocks the session until the transaction is applied at all database servers in the high-availability cluster, excluding RS secondary servers that are using DELAY_APPLY or STOP_APPLY. Other sessions at any database server in the high-availability cluster, excluding RS secondary servers that are using DELAY_APPLY or STOP_APPLY, are aware of the transaction commit and the transaction's effects.
- takes effect
- After you edit your onconfig file and restart the database server.
Usage
Set the CLUSTER_TXN_SCOPE configuration parameter to control transaction-commit returns from a high-availability cluster to client applications. Cluster transaction coordination can delay the returning of a transaction commit to a client application until the transaction is applied to a secondary-server or all secondary servers in a high-availability cluster. This process prevents operation failures due to asynchronous log processing, and ensures that the steps of multistep processes occur in serial order.
Cluster
transaction coordination does not apply to RS secondary servers that
have a DELAY_APPLY or STOP_APPLY configuration parameter value other
than 0
. Transactions do not need to be applied on
the RS secondary servers before client applications can receive commits.
CLUSTER_TXN_SCOPE affects sessions on read-only secondary servers and updatable secondary servers.
- Primary servers had a cluster transaction scope of SERVER.
- Read-only secondary servers were in the dirty-read isolation level, and could read uncommitted data.
- Updatable secondary servers had a cluster transaction scope of SESSION.
Example 1: Transactions coordination between high-availability cluster servers
In this example, a client application starts a two-step process. The client application inserts data on the primary database server, and then starts processing of the data on an HDR secondary server.
If a SELECT on the inserted data is attempted
on the HDR secondary server before the logs from the primary server
are applied on the HDR secondary server, the operation fails. To prevent
this failure, set the primary server's CLUSTER_TXN_SCOPE configuration
parameter to CLUSTER
, so that the client application
does not receive a commit, and cannot start data processing, until
the data insertion is also applied on the HDR secondary server.
Example 2: Transaction coordination on a database server
In this example, you have a client application that is divided into several stages of processing. Each stage of processing uses a different SQL session to connect to the database server. The application updates data, and then another part of the application processes the updated data in a different SQL session.
If CLUSTER_TXN_SCOPE
is set to SESSION, the part of the application that processes the
updated data might not be aware of an update's results and a failure
can occur. To prevent this failure, set the database server's CLUSTER_TXN_SCOPE
configuration parameter to SERVER
, so that the client
application does not receive a commit, and cannot start data processing
until the update completes on the database server.