A client can initiate a transaction that, in turn, can start a number of server transactions on possibly different hosts to carry out its processing. These descendent server transactions can be combined into a single integrated Global Transaction that is managed by Open/OLTP software.
An application can request a Global Transaction to be started by Setting to True the Two Phase Commit Segment configuration property under the Runtime Behavior category.
Global Transaction (GTR)
A Global Transaction, or GTR, collectively defines all of the transaction processing work anywhere in the network as being within the scope of a single transaction initiated by a client. The work can be performed by multiple application programs and Resource Managers (RMs), possibly on different machines. (The alternative to a Global Transaction is that each server request is processed as an independent transaction.)
When the Two Phase Commit property is set to True, your application initiates a GTR (unless the request is already part of a GTR as a service routine). Transaction boundaries (start and completion) for the GTR are specified by the application using the TX interface.
Open/OLTP software manages the entire transaction.
The Transaction Manager (TM) identifies and coordinates the start and completion (commit or rollback) of the GTR on behalf of the initiating application by communicating with participating RMs. If the GTR encompasses multiple nodes of participants, each of which is performing part of the work of the GTR, then Open/OLTP software uses a transaction tree (a tree structure identifying the hierarchy of participants) to manage the GTR. The completion of the GTR across the network of participants is done by using the Two-Phase commit protocol.
Two-Phase Commit (2PC)
Two-Phase commit is the protocol that Transaction Managers and Resource Managers use to commit or roll back Global Transactions.
During the first phase of this process, the Transaction Manager instructs the Resource Managers to prepare to commit the transaction work, and to guarantee the commitment.
In the second phase of the process, the Transaction Manager signals the Resource Managers to complete the transaction, by committing or rolling back the work.
The Two-Phase commit protocol ensures the atomicity of Global Transactions. It ensures that all database changes caused by a GTR are made permanent, or else all are nullified.
Global Transactions versus Non-Global Transactions
There can be significant differences between Global and non-Global transactions in an environment, depending upon the logic. If a non-Global transaction fails, the whole transaction is replayed, in some cases up to three times. If this logic contains multiple OLTP Automatic Entries, then any OLTP Automatic Entries that had previously been successful are redone. In some circumstances this is undesirable.
If Two-Phase Commit is set at the specification level, then a GTR is always started. If Two phase commit is set to True, OLTP transactions are included in the current GTR. If Two phase commit is set to False, OLTP transactions are excluded in the current GTR.