Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-40144

InnoDB: Add instant rollback for recovered transactions

    XMLWordPrintable

Details

    Description

      Large transactions can spend a long time rolling back after crash recovery.
      During that time InnoDB keeps rollback state and record locks for work that is
      only needed to make the old transaction effects disappear. This can delay
      recovery completion and keep affected records locked longer than necessary.

      This feature proposes an instant rollback mode for recovered InnoDB
      transactions whose undo record count reaches a configurable threshold. When the
      feature is enabled and a recovered transaction qualifies, InnoDB can release the
      transaction record locks and let row access handle the remaining undo state
      instead of running the full recovered transaction rollback immediately.

      Proposed user-visible configuration:

      • innodb_instant_rollback_enabled
        Enables or disables instant rollback.
      • innodb_instant_rollback_threshold
        Minimum number of undo records required before instant rollback is considered.

      The implementation tracks instant rollback state in trx_t and adds helper logic
      for recovered and normal rollback paths. Row undo and lock handling are extended
      to collect and release temporary instant-rollback record locks while preserving
      the existing rollback flow for transactions that do not qualify.

      The intended behavior is:

      • Existing rollback behavior remains unchanged when the feature is disabled.
      • Transactions below the configured threshold continue to use the normal rollback
        path.
      • Dictionary transactions and other transactions that are not safe for instant
        rollback continue to use the normal rollback path.
      • Crash recovery can expose recovered rows in their pre-transaction state without
        waiting for the whole recovered transaction rollback to finish.

      A new MTR test can cover the crash recovery case by enabling instant rollback,
      creating an uncommitted transaction, restarting the server, and verifying that
      the table contents are visible in the expected pre-transaction state.

      Attachments

        Issue Links

          Activity

            People

              alessandro.vetere Alessandro Vetere
              annbaek shimengchu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.75h
                  0.75h

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.