Transactional Support
An application program can group a set of updates into a unit of work. These
updates are usually logically related and must all be successful for data
integrity to be preserved. If one update succeeded while another failed then
data integrity would be lost.
A unit of work commits when it completes successfully. At this point all
updates made within that unit of work are made permanent or irreversible. If
the unit of work fails, all updates are instead backed out. Syncpoint coordination
is the process by which units of work are either committed or backed out
with integrity.
A local unit of work is one in which the only resources updated are those
belonging to the MQSeries queue manager. Syncpoint coordination is
provided by the queue manager itself, using a single-phase commit process.
A global unit of work is one in which resources that belong to other resource
managers, such as a DB2/400
®
database, are also updated. Here, a two-phase
commit procedure must be used and the unit of work is coordinated
externally by the operating system commitment controller.
Global units of work make it possible to integrate database updates within
MQSeries units of work. That is, you can write an application that makes
updates to MQSeries queues and to databases. You can issue commands to
commit or roll back the changes to both the queues and the databases.
This is achieved using a two-phase commit protocol. When a unit of work is
to be committed, the operating-system commitment controller first asks each
resource owner whether it is prepared to commit its updates. Only if the
database manager and the queue manager are both prepared to commit, are
all of the queue and database updates committed. If the database manager
cannot prepare its updates, the unit of work is backed out instead.
Full recovery support is provided if the queue manager loses contact with the
database manager during the commit process. If the database manager
becomes unavailable while it is in doubt (that is, it has been called to prepare
but the commitment controller has yet to receive a commit or backout
decision) the commitment controller remembers the outcome of the unit of
work until it has been successfully delivered. Similarly, if the queue manager
terminates with incomplete commit operations outstanding, these are
remembered over queue-manager restart.
Transactional Support
8
MQSeries for AS/400, V5.1 Quick Beginnings