In a heuristic rollback, either the database server or the administrator rolls back a piece of work that has already sent a can commit message.
The following two conditions can cause a heuristic rollback:
In either case, if the piece of work has already sent a can commit message to its coordinator, the action is considered a heuristic decision.
Under two-phase commit, a participant database server that is waiting for instructions from the coordinator is blocked from completing its transaction. Because the transaction remains open, the logical-log files that contain records associated with this transaction cannot be freed. The result is that the logical log continues to fill because of the activity of concurrent users.
If the logical log fills to the value of the long-transaction high-watermark (LTXHWM) while the participant is waiting, the database server directs all database server threads that own long transactions to begin rolling them back. If a piece of work that is precommitted is the offending long transaction, the database server has initiated a heuristic rollback. That is, this database server is rolling back a precommitted piece of work without the instruction or knowledge of the coordinator.
Under two-phase commit, the logical-log files that contain records associated with the piece of work are considered open until an ENDTRANS logical-log record is written. This type of transaction differs from a transaction involving a single database server where a rollback actually closes the transaction.
The logical log might continue to fill until the exclusive high-watermark is reached (LTXEHWM). If this happens, all user threads are suspended except those that are currently rolling back or currently committing. In the two-phase commit scenario, the open transaction prevents you from backing up the logical-log files and freeing space in the logical log. Under these specific circumstances, the logical log can fill completely. If this happens, the participant database server shuts down, and you must perform a data restore.
You, as administrator, can decide to initiate a heuristic rollback of a precommitted piece of work by executing onmode -z. You might make this decision because you want to free the resources that are held by the piece of work. (If you stop the participant thread by executing onmode -z, you free all locks and shared-memory resources that are held by the participant thread even though you do not end the transaction.)
This section describes what happens at both the coordinator and participant when a heuristic rollback occurs and how this process can result in an inconsistent database:
Transaction Completed Abnormally (rollback):
tx=address flags=0xnn
The participant thread at the database server where the heuristic rollback occurred returns error message -699 to the coordinator as follows:
-699 Transaction heuristically rolled back.
This error message is not returned to the application at this point; it is an internal notification to the coordinator. The coordinator waits until all participants respond to the commit instruction. The coordinator does not determine database consistency until all participants report.
The coordinator gathers all responses from participants. If every participant reports a heuristic rollback, the following events occur as a consequence:
Transaction heuristically rolled back.
-699 Transaction heuristically rolled back.
The coordinator gathers all responses from participants. If at least one participant reports a heuristic rollback and at least one reports an acknowledgment of a commit, the result is referred to as a mixed-transaction result. The following events occur as a consequence:
Mixed transaction result. (pid=nn user=userid)
The pid value is the user-process identification number of the coordinator process. The user value is the user ID associated with the coordinator process. Associated with this message are additional messages that list each of the participant database servers that reported a heuristic rollback. The additional messages take the following form:
Participant database server dbservername heuristically rolled back.
-698 Inconsistent transaction. Number and names of servers rolled back.
In this situation, examine the logical log at each participant database server site and determine whether your database system is consistent. (See Determining If a Transaction Was Implemented Inconsistently.)
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]