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

Found N prepared transactions after mariabackup SST

    XMLWordPrintable

Details

    • Can result in hang or crash
    • Q3/2026 Replic. Development

    Description

      Full message:
      2026-06-28 15:12:19 0 [ERROR] Found 2 prepared transactions! It means that server was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start server with --tc-heuristic-recover switch to commit or rollback pending transactions.

      Discovered when testing the fix for MDEV-38147:

      On the joiner, the wsrep XID continuity check (handler.cc:wsrep_order_and_check_continuity()) recovers a contiguous run of prepared wsrep XIDs starting at the SE checkpoint and stops at the first gap, potentially leaving some prepared transactions uncommitted.
      The post-recovery dry-run ha_recover(0) (mysqld.cc:init_server_conponents()) then finds those leftover prepared transactions and aborts.

      The non-contiguous prepared set in the mariabackup snapshot is almost certainly the the consequence of wsrep_slave_threads>0: parallel appliers preparing out of order.
      and the per-transaction rotation at 4096 makes the snapshot land mid-gap. It only affects the joiner.

      log_bin=ON seems to be essential for reproduction

      Attachments

        Issue Links

          Activity

            People

              Yurchenko Alexey Yurchenko
              Yurchenko Alexey Yurchenko
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 5d
                  5d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 2.25d Time Not Required
                  2.25d

                  Git Integration

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