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

FTS test crash on ALTER TABLE when InnoDB statistics tables are corrupted

    XMLWordPrintable

Details

    Description

      The test innodb_fts.versioning that was added in MDEV-25004 performs some dirty tricks. It replaces part of the data directory contents with the copy of an archived 10.3 data directory. On the merge to 10.7, I had to tweak the test. If the tweaks are reverted, the test will fail in a strange way:

      diff --git a/mysql-test/suite/innodb_fts/t/versioning.test b/mysql-test/suite/innodb_fts/t/versioning.test
      index f615f58e0d2..286597fba39 100644
      --- a/mysql-test/suite/innodb_fts/t/versioning.test
      +++ b/mysql-test/suite/innodb_fts/t/versioning.test
      @@ -75,18 +75,6 @@ call mtr.add_suppression("InnoDB: Table `mysql`.\`innodb_(table|index)_stats`");
       let $restart_bindir=;
       --source include/start_mysqld.inc
       
      -if ($MTR_COMBINATION_UPGRADE)
      -{
      -# The system tablespace was replaced with a 10.3 one that contains
      -# the InnoDB statistics tables. These tables are corrupted from our
      -# point of view. Drop the tables, but retain the .frm files to keep
      -# mtr.check_testcase() happy.
      ---move_file $datadir/mysql/innodb_index_stats.frm $datadir/iis.frm
      ---move_file $datadir/mysql/innodb_table_stats.frm $datadir/its.frm
      -DROP TABLE mysql.innodb_table_stats, mysql.innodb_index_stats;
      ---move_file $datadir/its.frm $datadir/mysql/innodb_table_stats.frm
      ---move_file $datadir/iis.frm $datadir/mysql/innodb_index_stats.frm
      -}
       --error ER_INDEX_CORRUPT
       SELECT * FROM articles WHERE MATCH (title,body)
       AGAINST ('Database' IN NATURAL LANGUAGE MODE);
      

      10.7 8356fb68c366b7f515f9060d964ee598653756a6 with the 10.6 test

      innodb_fts.versioning 'innodb,upgrade'   [ fail ]
              Test ended at 2023-01-04 15:20:39
       
      CURRENT_TEST: innodb_fts.versioning
      mysqltest: At line 79: query 'SELECT * FROM articles WHERE MATCH (title,body)
      AGAINST ('Database' IN NATURAL LANGUAGE MODE)' failed with wrong errno ER_TABLE_CORRUPT (1877): 'Table mysql/innodb_table_stats is corrupted. Please drop the table and recreate.', instead of ER_INDEX_CORRUPT (1712)...
      

      This error can be worked around as follows:

      diff --git a/mysql-test/suite/innodb_fts/t/versioning.test b/mysql-test/suite/innodb_fts/t/versioning.test
      index 286597fba39..a88c984df98 100644
      --- a/mysql-test/suite/innodb_fts/t/versioning.test
      +++ b/mysql-test/suite/innodb_fts/t/versioning.test
      @@ -75,6 +75,7 @@ call mtr.add_suppression("InnoDB: Table `mysql`.\`innodb_(table|index)_stats`");
       let $restart_bindir=;
       --source include/start_mysqld.inc
       
      +SET GLOBAL innodb_stats_persistent=0;
       --error ER_INDEX_CORRUPT
       SELECT * FROM articles WHERE MATCH (title,body)
       AGAINST ('Database' IN NATURAL LANGUAGE MODE);
      

      But then the server will crash later on:

      10.7 8356fb68c366b7f515f9060d964ee598653756a6 with statistics disabled

      innodb_fts.versioning 'innodb,upgrade'   [ fail ]
              Test ended at 2023-01-04 15:22:13
       
      CURRENT_TEST: innodb_fts.versioning
      mysqltest: At line 84: query 'alter table articles force' failed: <Unknown> (2013): Lost connection to server during query
      2023-01-04 15:22:12 3 [ERROR] mariadbd: Table mysql/innodb_table_stats is corrupted. Please drop the table and recreate.
      2023-01-04 15:22:12 3 [ERROR] mariadbd: Table mysql/innodb_index_stats is corrupted. Please drop the table and recreate.
      2023-01-04 15:22:12 3 [ERROR] mariadbd: Table mysql/innodb_table_stats is corrupted. Please drop the table and recreate.
      2023-01-04 15:22:12 3 [ERROR] mariadbd: Table mysql/innodb_index_stats is corrupted. Please drop the table and recreate.
      mariadbd: /mariadb/10.7/sql/sql_error.cc:335: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed.
      #11 0x000056274a388338 in Diagnostics_area::set_ok_status (this=0x7f92dc006cf0, affected_rows=10, last_insert_id=0, message=0x7f930823e7a0 "Records: 10  Duplicates: 0  Warnings: 5") at /mariadb/10.7/sql/sql_error.cc:335
      #12 0x000056274a3234f2 in my_ok (thd=<optimized out>, affected_rows_arg=<optimized out>, id=<optimized out>, message=<optimized out>) at /mariadb/10.7/sql/sql_class.h:5601
      #13 0x000056274a47d623 in mysql_alter_table (thd=thd@entry=0x7f92dc000d58, new_db=new_db@entry=0x7f92dc005a28, new_name=<optimized out>, create_info=create_info@entry=0x7f930823f4d0, table_list=<optimized out>, table_list@entry=0x7f92dc016b30, alter_info=alter_info@entry=0x7f930823f3e0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>) at /mariadb/10.7/sql/sql_table.cc:10969
      

      The offending error was flagged during a RENAME operation that was part of the ALTER TABLE…ALGORITHM=COPY operation:

      10.7 8356fb68c366b7f515f9060d964ee598653756a6

      #3  0x0000558215aa3f6f in my_message_sql (error=1877, 
          str=0x7fd9a005fe70 "Table mysql/innodb_table_stats is corrupted. Please drop the table and recreate.", MyFlags=64) at /mariadb/10.7/sql/mysqld.cc:3322
      #4  0x0000558216324198 in my_printf_error (error=1877, format=<optimized out>, 
          MyFlags=64) at /mariadb/10.7/mysys/my_error.c:153
      #5  0x000055821607b562 in dict_table_open_on_name (
          table_name=table_name@entry=0x55821534af46 "mysql/innodb_table_stats", 
          dict_locked=dict_locked@entry=false, 
          ignore_err=ignore_err@entry=DICT_ERR_IGNORE_NONE)
          at /mariadb/10.7/storage/innobase/dict/dict0dict.cc:1090
      #6  0x000055821604b1f6 in ha_innobase::rename_table (this=<optimized out>, 
          from=0x7fd9a0060990 "./test/articles", 
          to=0x7fd9a0060b90 "./test/#sql-backup-21235e-3")
      

      For some reason, the merge of MDEV-25004 to 10.6 did not require such tweaks, and it will not crash if this tweak is added.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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