04.04.2013 Views

Addressing OLTP Solutions with CICS: The Transaction Server ... - Ibm

Addressing OLTP Solutions with CICS: The Transaction Server ... - Ibm

Addressing OLTP Solutions with CICS: The Transaction Server ... - Ibm

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

88 <strong>CICS</strong> for AIX as the <strong>Transaction</strong> <strong>Server</strong><br />

A TM assigns a data structure called a transaction identifier (XID). <strong>The</strong> XID lets<br />

the TM track and coordinate all of the work associated <strong>with</strong> a global transaction.<br />

Each RM maps the XID to the recoverable work it did for the transaction. For<br />

global uniqueness, the XID should contain atomic action identifiers.<br />

Activity among Functional Components: Activity among the three functional<br />

components of the X/Open DTP model is dependent on the transaction operation.<br />

<strong>Transaction</strong> Initiation: When an AP instructs its TM to start a global transaction,<br />

the TM tells all appropriate RMs to associate the information about the global<br />

transaction <strong>with</strong> any work the AP may request from them.<br />

Some RMs are configured so that the TM does not inform them when a global<br />

transaction starts. <strong>The</strong> RM contacts the TM to become associated <strong>with</strong> a global<br />

transaction only after the AP calls it to request actual work. This is called<br />

dynamic registration. If static registration is requested, each new transaction in<br />

the process generates a call to the RM that tells it that it has joined a new<br />

transaction or resumed an old one.<br />

<strong>Transaction</strong> Commitment: When an AP instructs its TM to commit a transaction,<br />

the TM and RMs use two-phase-commit presumed rollback to ensure that the<br />

transaction′s updates are atomic.<br />

In phase 1, the TM asks all RMs to prepare to commit (or prepare) their work. It<br />

also asks whether the RM can guarantee its ability to commit the work it did on<br />

behalf of a global transaction. If an RM can commit its work, it replies<br />

affirmatively. A negative reply reports failure.<br />

In phase 2, the TM directs all RMs either to commit or to roll back the work done<br />

on behalf of a global transaction, as the case may be. All RMs commit or roll<br />

back changes to shared resources and then return status to the TM.<br />

When an AP calls its TM to commit a global transaction, the TM reports on<br />

whether commitment or rollback was the outcome. This report is based on<br />

reports the TM received (directly or through other TMs) from all involved RMs.<br />

<strong>The</strong> XA specification contains two optimizations in the calling sequence between<br />

the TM and RM. An RM can <strong>with</strong>draw from further participation in a global<br />

transaction during phase 1 if it was not asked to update shared resources (the<br />

read-only optimization). A TM can use one-phase commit if it is dealing <strong>with</strong><br />

only one RM that is making changes to shared resources.<br />

<strong>The</strong> XA specification discusses requirements for stable recording of transaction<br />

data, including specifying when the TM and RMs are free to discard their<br />

knowledge of the global transaction.<br />

<strong>Transaction</strong> Rollback: <strong>The</strong> TM rolls back the global transaction if any RM<br />

responds negatively to the phase 1 request or the AP directs the TM to roll back<br />

the global transaction.<br />

<strong>The</strong> TM effects phase 2 by telling RMs to roll back the transaction. <strong>The</strong> RMs<br />

must not let any changes to shared resources become permanent.<br />

Heuristic <strong>Transaction</strong> Completion: In certain, unusual, cases, the RM could<br />

experience a long delay between phases 1 and 2 of the two-phase-commit<br />

protocol. For example, the TM that issued the prepare-to-commit (phase 1)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!