Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-7067

KahaDB Recovery can experience a dangling transaction when prepare and commit occur on different data files.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.15.6
    • Fix Version/s: 5.16.0, 5.15.7
    • Component/s: KahaDB, XA
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Flags:
      Patch

      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

          Issue Links

            Activity

              People

              • Assignee:
                gtully Gary Tully
                Reporter:
                jgoodyear Jamie goodyear
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: