Chapter 9. Recovery

This chapter explains some advanced concepts that the LIXA system administrator should know to solve some complex issues the XA technology could generate. LIXA technology provide two type of recovery:

Important

lixar utility was designed to operate with statically defined XA Resource Managers described in lixac_conf.xml configuration file. XTA, explained in Chapter 8, Developing Application Programs using XTA (XA Transaction API) interface, introduces dynamically defined XA Resource Managers that can't be managed by lixar utility if they are not defined in lixac_conf.xml too

Automatic (warm) recovery

Scenario 1: autonoumos rollback

If your environment is configured and runs as designed, when an Application Program fails an automatic recovery operation fix the problem as soon as possible. Below there is a first trivial scenarios:

  • the Application Program crashes before it reaches the xa_prepare() function (called by tx_commit())

  • the Resource Managers autonoumosly roll back the work in progress and the environment is cleaned up

the distributed transaction started but it did not initiated the two phase commit protocol: there is no relevant difference between this scenario and a single Resource Manager (one phase commit) scenario. The LIXA Transaction Manager does not manage a recovery phase.

Figure 9.1. The Application Program crashes before xa_prepare()

The Application Program crashes before xa_prepare()


Scenario 2: a second Application Program triggers the recovery action

The following scenario is slightly different:

  • the Application Program crashes after it has passed the xa_prepare() function but before it reaches the xa_commit() function

  • the Resource Managers keep the prepared transaction in flight until the Transaction Manager decides the proper recovery action

  • an equivalent Application Program starts and activates the LIXA Transaction Manager with tx_open()

  • the LIXA Transaction Manager discovers there is a prepared transaction and establishes that it must commit the transaction

  • the second Application Program implicitly and inconsciously started the recovery process of a previously crashed Application Program

Figure 9.2. The Application Program crashes after xa_prepare()

The Application Program crashes after xa_prepare()


The above pattern is the result of the LIXA design: the Transaction Manager is not an active component, but it's a passive one and is embedded in the Application Program when it links the lixac library and activates it with the tx_open() function.

Note

Depending on the crash time: slightly before the prepare phase, in the middle of the prepare phase, after the completion of the prepare phase, the LIXA Transaction Manager chooses a different recovery operation between xa_commit() and xa_rollback().