Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-3801

Add advanced ActionExpiryScanner based on creation time

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 7.0.1.Final
    • 7.0.0.Final
    • Recovery
    • None
    • Hide
      To avoid filling logs with with "expired" transactions we provide implementations of the ExpiryScanner interface which run periodically (the default is every 12 hours) and if the same entry is present on consecutive scans then it is moved to a different part of the store (we keep a copy to avoid mistakes) where it is no longer eligible for recovery. This can happen if a resource cannot be contacted and/or the resource does not have a record of the transaction which can happen if it crashed after the TM wrote its log but before the resource could - this later case should now be a rare occurrence since we fixed JBTM-860 (use XAResourceWrapper metadata for assume complete). Because the operation of moving logs is potentially dangerous the scanners are disabled by default.

      The change introduced by JBTM-3801 adds two new scanners (AdvancedAtomicActionExpiryScanner and AdvancedAtomicActionPurgeExpiryScanner) which operate based on the time the log was created and if an entry is found that has remained in the log for longer than the default scan period then it becomes eligible for expiry (the AdvancedAtomicActionExpiryScanner moves the entry whereas the AdvancedAtomicActionPurgeExpiryScanner deletes it). These scanners avoid the need to wait for a second recovery pass which can be of benefit for short-lived applications.

      Warning, expiring logs based on creation time can be an issue if the system is not brought back up after a crash within the ExpiryScanner scan interval since a log will be immediately expired before there is an attempt to recover the log because the scanners run before a recovery cycle.
      Show
      To avoid filling logs with with "expired" transactions we provide implementations of the ExpiryScanner interface which run periodically (the default is every 12 hours) and if the same entry is present on consecutive scans then it is moved to a different part of the store (we keep a copy to avoid mistakes) where it is no longer eligible for recovery. This can happen if a resource cannot be contacted and/or the resource does not have a record of the transaction which can happen if it crashed after the TM wrote its log but before the resource could - this later case should now be a rare occurrence since we fixed JBTM-860 (use XAResourceWrapper metadata for assume complete). Because the operation of moving logs is potentially dangerous the scanners are disabled by default. The change introduced by JBTM-3801 adds two new scanners (AdvancedAtomicActionExpiryScanner and AdvancedAtomicActionPurgeExpiryScanner) which operate based on the time the log was created and if an entry is found that has remained in the log for longer than the default scan period then it becomes eligible for expiry (the AdvancedAtomicActionExpiryScanner moves the entry whereas the AdvancedAtomicActionPurgeExpiryScanner deletes it). These scanners avoid the need to wait for a second recovery pass which can be of benefit for short-lived applications. Warning, expiring logs based on creation time can be an issue if the system is not brought back up after a crash within the ExpiryScanner scan interval since a log will be immediately expired before there is an attempt to recover the log because the scanners run before a recovery cycle.

      The current implementation of com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionScanner is based on the requirement of a long-running application to evaluate which transactions are expired. It uses Hashtables to fill potential items to be evaluated as expired in the next run of the com.arjuna.ats.arjuna.recovery.RecoveryModule. That is quite problematic for short running applications which are scaled up and down (Kubernetes apps for example). In this use cases, an approach based on transaction creation time (introduced in Narayana 7.0) is a better criterion because you only need one run, which even can be the initial run at application startup.

              Unassigned Unassigned
              graben1181 Benjamin Graf
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: