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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 5.15.6
    • 5.15.7, 5.16.0
    • KahaDB, XA
    • None
    • Patch Available
    • 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

        1. amq7067test.patch
          8 kB
          Jamie Mark Goodyear

        Issue Links

          Activity

            People

              gtully Gary Tully
              jgoodyear Jamie Mark Goodyear
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: