Home | Previous Page | Next Page   Distributed Data > Multiphase Commit Protocols > Independent Actions >

The Heuristic End-Transaction Scenario

A heuristic end transaction is an independent action taken by the administrator to roll back a piece of work and remove all information about the transaction from the transaction table. The heuristic end-transaction process is initiated when the administrator executes the onmode -Z address command.

Whenever you initiate a heuristic end transaction by executing onmode -Z, you remove critical information required by the database server to support the two-phase commit protocol and its automatic-recovery features. If you execute onmode -Z, it becomes your responsibility to determine whether your networked database system is consistent.

When to Perform a Heuristic End Transaction

You should execute the onmode -Z option to initiate a heuristic end transaction in only one, rare, situation. This situation occurs when a piece of work that has been heuristically rolled back remains open, preventing your logical-log files from becoming free. As a result, the logical log is dangerously close to full.

In general, the coordinator issues its commit-or-rollback decision within a reasonable period of time. However, if the coordinator fails and does not return online to end a transaction that was heuristically rolled back at your participant database server, you might face a serious problem.

The problem scenario begins in this way:

  1. The participant thread that is executing a piece of work on behalf of a global transaction has sent a can commit response to the coordinator.
  2. The piece of work waits for instructions from the coordinator.
  3. While the piece of work is waiting, the logical log fills past the long-transaction high-watermark.
  4. The piece of work that is waiting for instructions is the source of the long transaction. The participant database server directs the executing thread to roll back the piece of work. This action is a heuristic rollback.
  5. The participant continues to wait for the coordinator to direct it to end the transaction. The transaction remains open. The logical log continues to fill.

If the coordinator contacts the participant and directs it to end the transaction in a reasonable period of time, no problem develops. The serious problem arises if the heuristic rollback occurs at a participant database server and subsequently the coordinator fails, preventing the coordinator from directing the participant to end the transaction.

As a consequence, the transaction remains open. The open transaction prevents you from backing up logical-log files and freeing space in the logical log. As the logical log continues to fill, it might reach the point specified by the exclusive-access, long-transaction high-watermark (LTXEHWM). If this point is reached, normal processing is suspended. At some point after the high-watermark is reached, you must decide if the open transaction is endangering your logical log. The danger is that if the logical log fills completely, the database server shuts down, and you must perform a data restore.

You must decide whether to end the transaction and protect your system against the possibility of filling the logical log, despite all the problems associated with executing onmode -Z, or to wait and see if communication with the coordinator can be reestablished in time to end the transaction before the logical log fills.

How to Use onmode -Z

The onmode -Z address command is intended for use only if communication between the coordinator and the participant is broken. To ensure that communication is really broken, the onmode -Z command does not execute unless the thread that was executing the piece of work has been dead for the amount of time specified by TXTIMEOUT. For more information on this option, see the IBM Informix Administrator's Reference.

The address parameter is obtained from onstat -x output. For more information on the onstat -x option, see the IBM Informix Administrator's Reference.

Action When the Transaction Is Ended Heuristically

When you execute onmode -Z, you direct the onmode utility to remove the participant transaction entry, which is located at the specified address, from the transaction table.

Two records are written in the logical log to document the action. The records are type ROLLBACK and ENDTRANS, or if the transaction was already heuristically rolled back, ENDTRANS only. The following message is written to the participant database server message log:

(time_stamp) Transaction Completed Abnormally (endtx): tx=address flags:0xnn user username tty ttyid

The coordinator receives an error message from the participant where the onmode -Z occurred, in response to its COMMIT instruction. The coordinator queries the participant database server, which no longer has information about the transaction. The lack of a transaction-table entry at the participant database server indicates that the transaction committed. The coordinator assumes that the acknowledgment message was sent from the participant, but somehow it was not received. Because the coordinator does not know that this participant's piece of work did not commit, it does not generate messages indicating that the global transaction was inconsistently implemented. Only the administrator who executed the onmode -Z command is aware of the inconsistent implementation.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]