In-doubt transactions - commit or backout?
Girish D V |Nov 17 2016 Updated
In-doubt transactions are the transactions which are in prepared state but are not yet committed. Details about in-doubt transactions are available here. In-doubt transactions can be identified in UNCOM parameter of the 'dis qstatus'. The details of the in-doubt transactions can be identified from 'dspmqtrn -m QM' command. So once we identify in-doubt transactions, how do we handle it? The answer is the rsvmqtrn command, but what action should be taken? Either we commit or backout the transaction. The commit action will complete whatever the action in which the transaction was involved and backout will just undo the action in which the transaction is involved. To understand what happens with the message with either of these actions, first we need to identify in what operation (put or get) the transaction was involved in. For this we need to capture transaction dumps using amqldmpa command, as follows:
amqldmpa -m QM_NAME -cA -d15 -o2 -f /var/mqm/errors/atm.out amqldmpa -m QM_NAME -cK -d8 -f /var/mqm/errors/kern.out
The dumps can be verified to check for the in-doubt transaction based on transaction id or transaction number. The Waiter section of a transaction in above kern output can be used to identify the operation involved either put or get along with options used. If the connection no longer exists then the transaction will not be available in amqldmpa's kern.out in which case we need to look in atm.out file for the transaction. The long running in-doubt transaction in atm.out file will have SLE structure which gives the operation the transaction was involved. Once we have identified the operation in which the in-doubt transaction was involved in, the user can take appropriate action
- If the in-doubt transaction is involved in a put operation:
A commit on the transaction will put the message back on the queue, whereas a backout of the transaction will result in loss of the message.
- If the in-doubt transaction is involved in a get operation:
A commit on the transaction will result in loss of the message, whereas backout on the transaction will put the message back on the queue.