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

ER_TABLE_SCHEMA_MISMATCH or Assertion `index->is_dummy || index->table->instant' failed in rec_get_offsets_func upon IMPORT TABLESPACE

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      --let $datadir= `select @@datadir`
       
      CREATE TABLE t1 (a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
      ALTER TABLE t1 ADD b INT FIRST;
       
      FLUSH TABLES t1 FOR EXPORT;
      --copy_file $datadir/test/t1.cfg $MYSQLTEST_VARDIR/t1.cfg
      --copy_file $datadir/test/t1.ibd $MYSQLTEST_VARDIR/t1.ibd
      UNLOCK TABLES;
       
      DROP TABLE t1;
      CREATE TABLE t1 (b INT, a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
       
      ALTER TABLE t1 DISCARD TABLESPACE;
      --copy_file $MYSQLTEST_VARDIR/t1.cfg $datadir/test/t1.cfg
      --copy_file $MYSQLTEST_VARDIR/t1.ibd $datadir/test/t1.ibd
      ALTER TABLE t1 IMPORT TABLESPACE;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 3454b5cf

      2021-01-03  0:28:03 9 [Note] InnoDB: Phase I - Update all pages
      mysqld: /data/src/10.4/storage/innobase/rem/rem0rec.cc:911: rec_offs* rec_get_offsets_func(const rec_t*, const dict_index_t*, rec_offs*, bool, ulint, const char*, unsigned int, mem_heap_t**): Assertion `index->is_dummy || index->table->instant' failed.
      210103  0:28:03 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f00cfc5ff36 in __GI___assert_fail (assertion=0x55c5fcff5200 "index->is_dummy || index->table->instant", file=0x55c5fcff4878 "/data/src/10.4/storage/innobase/rem/rem0rec.cc", line=911, function=0x55c5fcff4f80 "rec_offs* rec_get_offsets_func(const rec_t*, const dict_index_t*, rec_offs*, bool, ulint, const char*, unsigned int, mem_heap_t**)") at assert.c:101
      #8  0x000055c5fc7aa8b2 in rec_get_offsets_func (rec=0x7f00701c407f "\200", index=0x7f00701b55a0, offsets=0x7f00c8e23098, leaf=true, n_fields=18446744073709551615, file=0x55c5fcffbac8 "/data/src/10.4/storage/innobase/row/row0import.cc", line=1820, heap=0x7f00c8e232f8) at /data/src/10.4/storage/innobase/rem/rem0rec.cc:911
      #9  0x000055c5fc7cd295 in PageConverter::update_records (this=0x7f00c8e23000, block=0x7f0070132100) at /data/src/10.4/storage/innobase/row/row0import.cc:1820
      #10 0x000055c5fc7cd8ca in PageConverter::update_index_page (this=0x7f00c8e23000, block=0x7f0070132100) at /data/src/10.4/storage/innobase/row/row0import.cc:1982
      #11 0x000055c5fc7cdda3 in PageConverter::update_page (this=0x7f00c8e23000, block=0x7f0070132100, page_type=@0x7f00c8e22978: 18) at /data/src/10.4/storage/innobase/row/row0import.cc:2064
      #12 0x000055c5fc7c4673 in PageConverter::operator() (this=0x7f00c8e23000, block=0x7f0070132100) at /data/src/10.4/storage/innobase/row/row0import.cc:2112
      #13 0x000055c5fc7c838e in fil_iterate (iter=..., block=0x7f0070132100, callback=...) at /data/src/10.4/storage/innobase/row/row0import.cc:3559
      #14 0x000055c5fc7c96ea in fil_tablespace_iterate (table=0x7f0070159c30, n_io_buffers=64, callback=...) at /data/src/10.4/storage/innobase/row/row0import.cc:3832
      #15 0x000055c5fc7ca1d5 in row_import_for_mysql (table=0x7f0070159c30, prebuilt=0x7f007005a030) at /data/src/10.4/storage/innobase/row/row0import.cc:4017
      #16 0x000055c5fc663c75 in ha_innobase::discard_or_import_tablespace (this=0x7f0070133208, discard=0 '\000') at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:13004
      #17 0x000055c5fc405db1 in handler::ha_discard_or_import_tablespace (this=0x7f0070133208, discard=0 '\000') at /data/src/10.4/sql/handler.cc:4594
      #18 0x000055c5fc17a2c6 in mysql_discard_or_import_tablespace (thd=0x7f0070000d90, table_list=0x7f0070013540, discard=false) at /data/src/10.4/sql/sql_table.cc:6024
      #19 0x000055c5fc2205bc in Sql_cmd_discard_import_tablespace::execute (this=0x7f0070013c08, thd=0x7f0070000d90) at /data/src/10.4/sql/sql_alter.cc:557
      #20 0x000055c5fc09776b in mysql_execute_command (thd=0x7f0070000d90) at /data/src/10.4/sql/sql_parse.cc:6160
      #21 0x000055c5fc09cd19 in mysql_parse (thd=0x7f0070000d90, rawbuf=0x7f0070013458 "ALTER TABLE t1 IMPORT TABLESPACE", length=32, parser_state=0x7f00c8e24550, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7958
      #22 0x000055c5fc089041 in dispatch_command (command=COM_QUERY, thd=0x7f0070000d90, packet=0x7f00700087b1 "ALTER TABLE t1 IMPORT TABLESPACE", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1855
      #23 0x000055c5fc0878a9 in do_command (thd=0x7f0070000d90) at /data/src/10.4/sql/sql_parse.cc:1373
      #24 0x000055c5fc216b93 in do_handle_one_connection (connect=0x55c5fff72f80) at /data/src/10.4/sql/sql_connect.cc:1412
      #25 0x000055c5fc2168dc in handle_one_connection (arg=0x55c5fff72f80) at /data/src/10.4/sql/sql_connect.cc:1316
      #26 0x000055c5fcc37768 in pfs_spawn_thread (arg=0x55c5fff65630) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #27 0x00007f00d04e0609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x00007f00cfd4b293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Slightly different assertion on 10.5:

      10.5 1bf9acce

      2021-01-03  0:30:09 4 [Note] InnoDB: Phase I - Update all pages
      mariadbd: /data/src/10.5/storage/innobase/rem/rem0rec.cc:920: rec_offs* rec_get_offsets_func(const rec_t*, const dict_index_t*, rec_offs*, bool, ulint, const char*, unsigned int, mem_heap_t**): Assertion `index->table->instant' failed.
      210103  0:30:09 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc2fd8f6f36 in __GI___assert_fail (assertion=0x55b4abba0069 "index->table->instant", file=0x55b4abb9f6e8 "/data/src/10.5/storage/innobase/rem/rem0rec.cc", line=920, function=0x55b4abb9fdf0 "rec_offs* rec_get_offsets_func(const rec_t*, const dict_index_t*, rec_offs*, bool, ulint, const char*, unsigned int, mem_heap_t**)") at assert.c:101
      #8  0x000055b4ab3b30e2 in rec_get_offsets_func (rec=0x7fc2c8b4807f "\200", index=0x7fc2c81ac008, offsets=0x7fc2f809f7e0, leaf=true, n_fields=18446744073709551615, file=0x55b4abba6ee0 "/data/src/10.5/storage/innobase/row/row0import.cc", line=1841, heap=0x7fc2f809fa40) at /data/src/10.5/storage/innobase/rem/rem0rec.cc:920
      #9  0x000055b4ab3d544d in PageConverter::update_records (this=0x7fc2f809f2a0, block=0x7fc2c8043138) at /data/src/10.5/storage/innobase/row/row0import.cc:1841
      #10 0x000055b4ab3d5b48 in PageConverter::update_index_page (this=0x7fc2f809f2a0, block=0x7fc2c8043138) at /data/src/10.5/storage/innobase/row/row0import.cc:2024
      #11 0x000055b4ab3d5fa5 in PageConverter::update_page (this=0x7fc2f809f2a0, block=0x7fc2c8043138, page_type=@0x7fc2f809e662: 18) at /data/src/10.5/storage/innobase/row/row0import.cc:2086
      #12 0x000055b4ab3cc7be in PageConverter::operator() (this=0x7fc2f809f2a0, block=0x7fc2c8043138) at /data/src/10.5/storage/innobase/row/row0import.cc:2134
      #13 0x000055b4ab3d0520 in fil_iterate (iter=..., block=0x7fc2c8043138, callback=...) at /data/src/10.5/storage/innobase/row/row0import.cc:3554
      #14 0x000055b4ab3d17be in fil_tablespace_iterate (table=0x7fc2c810d0a8, n_io_buffers=64, callback=...) at /data/src/10.5/storage/innobase/row/row0import.cc:3813
      #15 0x000055b4ab3d22cc in row_import_for_mysql (table=0x7fc2c810d0a8, prebuilt=0x7fc2c8056018) at /data/src/10.5/storage/innobase/row/row0import.cc:3994
      #16 0x000055b4ab262a71 in ha_innobase::discard_or_import_tablespace (this=0x7fc2c80557c0, discard=0 '\000') at /data/src/10.5/storage/innobase/handler/ha_innodb.cc:13074
      #17 0x000055b4aade2f7b in handler::ha_discard_or_import_tablespace (this=0x7fc2c80557c0, discard=0 '\000') at /data/src/10.5/sql/handler.cc:4817
      #18 0x000055b4aab67e2c in mysql_discard_or_import_tablespace (thd=0x7fc2c8000db8, table_list=0x7fc2c8014020, discard=false) at /data/src/10.5/sql/sql_table.cc:6273
      #19 0x000055b4aac1cc82 in Sql_cmd_discard_import_tablespace::execute (this=0x7fc2c80146f8, thd=0x7fc2c8000db8) at /data/src/10.5/sql/sql_alter.cc:581
      #20 0x000055b4aaa739cc in mysql_execute_command (thd=0x7fc2c8000db8) at /data/src/10.5/sql/sql_parse.cc:6006
      #21 0x000055b4aaa79d88 in mysql_parse (thd=0x7fc2c8000db8, rawbuf=0x7fc2c8013f30 "ALTER TABLE t1 IMPORT TABLESPACE", length=32, parser_state=0x7fc2f80a0510, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8042
      #22 0x000055b4aaa65d6b in dispatch_command (command=COM_QUERY, thd=0x7fc2c8000db8, packet=0x7fc2c80090a9 "ALTER TABLE t1 IMPORT TABLESPACE", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1872
      #23 0x000055b4aaa6455f in do_command (thd=0x7fc2c8000db8) at /data/src/10.5/sql/sql_parse.cc:1353
      #24 0x000055b4aac11e9f in do_handle_one_connection (connect=0x55b4adf918a8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1410
      #25 0x000055b4aac11c02 in handle_one_connection (arg=0x55b4adfab308) at /data/src/10.5/sql/sql_connect.cc:1312
      #26 0x000055b4ab17074d in pfs_spawn_thread (arg=0x55b4adf914e8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #27 0x00007fc2fde0e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x00007fc2fd9e2293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      --source include/have_innodb.inc
       
      --let $datadir= `select @@datadir`
       
      CREATE TABLE t1 (a INT) ENGINE=InnoDB;
      ALTER TABLE t1 ADD b INT FIRST;
       
      FLUSH TABLES t1 FOR EXPORT;
      --copy_file $datadir/test/t1.cfg $MYSQLTEST_VARDIR/t1.cfg
      --copy_file $datadir/test/t1.ibd $MYSQLTEST_VARDIR/t1.ibd
      UNLOCK TABLES;
       
      DROP TABLE t1;
      CREATE TABLE t1 (b INT, a INT) ENGINE=InnoDB;
       
      ALTER TABLE t1 DISCARD TABLESPACE;
      --copy_file $MYSQLTEST_VARDIR/t1.cfg $datadir/test/t1.cfg
      --copy_file $MYSQLTEST_VARDIR/t1.ibd $datadir/test/t1.ibd
      ALTER TABLE t1 IMPORT TABLESPACE;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 3454b5cf

      query 'ALTER TABLE t1 IMPORT TABLESPACE' failed: 1808: Schema mismatch (Index field name b doesn't match tablespace metadata field name a for field position 3)
      

      The 2nd variation, with ER_TABLE_SCHEMA_MISMATCH, affects debug and release builds alike.
      The first test case doesn't cause any obvious immediate effect on non-debug builds.

      Both failures appeared in 10.4 after this commit:

      Author: Marko Mäkelä
      Date:   Fri Sep 27 16:01:55 2019 +0300
       
          MDEV-20117: Fix another scenario
      

      See also MDEV-24352.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              elenst Elena Stepanova
              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.