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

Sporadic [ERROR] InnoDB: Transaction was aborted due to Record changed on SELECT ... FOR UPDATE inside trx

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      Sporadic issue. Issue occurence depends on load of server and whetter it is a debug (more often) or optimized/release build (less often). Occurence can be 1-in-3 to 1-in-100+.

      SET SESSION log_warnings=50, GLOBAL innodb_stats_persistent=ON;
      CREATE TABLE t (c INT);
      BEGIN;
      INSERT INTO t VALUES (0),(0);
      SELECT * FROM t;
      SELECT * FROM mysql.innodb_table_stats WHERE table_name='a' FOR UPDATE;
      

      Leads to:

      CS 12.2.0 fd15fd2765b53d0c070dd01d86fb231024b8f284 (Debug, Clang 21.1.3-20250923) Build 10/11/2025

      12.2.0-dbg>SELECT * FROM mysql.innodb_table_stats WHERE table_name='a' FOR UPDATE;
      ERROR 1020 (HY000): Record has changed since last read in table 'innodb_table_stats'
      

      Example output from opt/release build error log:

      CS 12.2.0 fd15fd2765b53d0c070dd01d86fb231024b8f284 (Optimized, Clang 21.1.3-20250923) Build 10/11/2025

      2025-12-09 16:15:26 4 [ERROR] InnoDB: Transaction was aborted due to Record changed
      

      Note the table name t <> a.

      Issue observed in all current versions from CS 11.8 to 12.3 and in ES 11.8. Not observed [yet] in older versions.

      Oddly, changing log_warnings to 1/2/3 makes the issue non-reproducible.

      Attachments

        Activity

          People

            marko Marko Mäkelä
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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