Details
Description
KahaDB Recovery can experience a dangling transaction when prepare and commit occur on different data files.
Scenario:
A XA Transaction is started, message is prepared and sent into Broker.
We then send into broker enough messages to file page file (100 message with 512 * 1024 characters in message payload). This forces a new data file to be created.
Commit the XA transaction. Commit will land on the new data file.
Restart the Broker.
Upon restart a KahaDB recovery is executed.
The prepare in PageFile 1 is not matched to Commit on PageFile 2, as such, it will appear in recovered message state.
Looking deeper into this scenario, it appears that the commit message is GC'd, hence the prepare & commit can not be matched.
The MessageDatabase only checks the following for GC:
// Don't GC files referenced by in-progress txif (inProgressTxRange[0] != null) {
for (int pendingTx=inProgressTxRange[0].getDataFileId(); pendingTx <= inProgressTxRange[1].getDataFileId(); pendingTx++) {
gcCandidateSet.remove(pendingTx); }
}
We need to become aware of where the prepare & commits occur in pagefiles with respect to GCing files.
Attachments
Attachments
Issue Links
- relates to
-
AMQ-8201 ACK compaction with local transactions
-
- Resolved
-
- links to