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

[ERROR] InnoDB: Cannot save index statistics...Lock wait timeout and slow INSERT

    XMLWordPrintable

Details

    Description

      Split from MDEV-32667. Re-verified on all versions. For 10.5 and 10.6 re-verification was done on the latest revisions
      (10.5.28 7afee25b08bf801a97ce3246bb604d388572eace and 10.6.21 074831ec61e8cd2c003df1a7316f202cbb902474),
      which include the MDEV-32667 patch using debug UB+ASAN builds. No UB/ASAN traces were observed anymore,
      however other symptoms remain as mentioned in MDEV-32667:

      SET GLOBAL innodb_stats_persistent=0;
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      XA START 'a';
      UPDATE mysql.innodb_index_stats SET stat_value=0;
      SET GLOBAL innodb_stats_persistent=DEFAULT;
      SELECT * FROM t;
      SET GLOBAL table_open_cache=DEFAULT;
      INSERT INTO t VALUES (0,0,0,0,0,0);
      

      Leads to:

      CS 10.5.28 7afee25b08bf801a97ce3246bb604d388572eace (Debug, UBASAN)

      10.5.28-dbg>INSERT INTO t VALUES (0,0,0,0,0,0);
      ERROR 1136 (21S01): Column count doesn't match value count at row 1
      

      CS 10.5.28 7afee25b08bf801a97ce3246bb604d388572eace (Debug, UBASAN)

      2024-11-09  6:57:59 0 [Note] /test/UBASAN_MD091124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadbd: ready for connections.
      Version: '10.5.28-MariaDB-debug'  socket: '/test/UBASAN_MD091124-mariadb-10.5.28-linux-x86_64-dbg/socket.sock'  port: 11057  MariaDB Server
      2024-11-09  6:58:03 4 [ERROR] InnoDB: Cannot save index statistics for table `test`.`t`, index `GEN_CLUST_INDEX`, stat name "n_diff_pfx01": Lock wait timeout
      

      And in 10.6:

      CS 10.6.21 074831ec61e8cd2c003df1a7316f202cbb902474 (Debug, UBASAN)

      10.6.21-dbg>INSERT INTO t VALUES (0,0,0,0,0,0);
      ERROR 1136 (21S01): Column count doesn't match value count at row 
      

      With no error in the server log, however the ERROR 1136 takes about 50 seconds to show. The same delay continues in higher versions (tested 11.2 and 11.7).

      This testcase:

      CREATE TABLE t (c INT) ENGINE=InnoDB;
      INSERT INTO t VALUES (0),(0);
      INSERT INTO t VALUES (0),(0);
      SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
      XA START 'a', 'b';
      INSERT INTO t VALUES (0),(0);
      SELECT * FROM mysql.innodb_index_stats WHERE table_name='t';
      SELECT SLEEP(10);
      

      Leads to the same outcome on 10.5:

      CS 10.5.28 7afee25b08bf801a97ce3246bb604d388572eace (Debug, UBASAN)

      2024-11-09  7:07:41 0 [ERROR] InnoDB: Cannot save index statistics for table `test`.`t`, index `GEN_CLUST_INDEX`, stat name "n_diff_pfx01": Lock wait timeout
      

      With no observable issues on 10.6. The same results (10.5 error, no observable 10.6 issues) apply to this testcase:

      CREATE TABLE t (c1 INT,c2 INT,c3 INT);
      INSERT INTO t VALUES (0,0,0),(0,0,0),(0,0,0);
      INSERT INTO t VALUES (0,0,0),(0,0,0),(0,0,0);
      XA START 'a';
      SELECT SLEEP(5);
      DELETE FROM mysql.innodb_table_stats;
      SELECT SLEEP(7);
      

      I also tested the first testcase on regular (non-SAN) 10.5 and 10.6 builds, and the results were indentical, i.e. error for 10.5 and long wait for the INSERT on 10.6.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              Roel Roel Van de Paar
              Votes:
              1 Vote for this issue
              Watchers:
              3 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.