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

Assertion `table->s->db_options_in_use == part_table->s->db_options_in_use' with DELAY_KEY_WRITE and Aria

    XMLWordPrintable

Details

    Description

      Filing separately from MDEV-18858, as that one relies on debug_dbug, which often leads to dismissal.

      --source include/have_partition.inc
       
      SET @delay.save= @@delay_key_write;
      SET GLOBAL delay_key_write= ALL;
       
      --connect (con1,localhost,root,,)
      CREATE TABLE t1 (a INT) ENGINE=Aria PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100));
      CREATE TABLE t2 LIKE t1;
      ALTER TABLE t2 REMOVE PARTITIONING;
      --connection default
      ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
       
      # Cleanup
      DROP TABLE t1, t2;
      SET GLOBAL delay_key_write= @delay.save;
      

      10.4 a5998145ba52613e4dfa08d9fe33754d14210bf4

      mysqld: /data/bld/10.4-asan/sql/sql_partition_admin.cc:260: bool compare_table_with_partition(THD*, TABLE*, TABLE*, partition_element*, uint): Assertion `table->s->db_options_in_use == part_table->s->db_options_in_use' failed.
      240226  1:02:10 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f80d5e53e32 in __GI___assert_fail (assertion=0x563ce1c4ff40 "table->s->db_options_in_use == part_table->s->db_options_in_use", file=0x563ce1c4faa0 "/data/bld/10.4-asan/sql/sql_partition_admin.cc", line=260, function=0x563ce1c4ffa0 "bool compare_table_with_partition(THD*, TABLE*, TABLE*, partition_element*, uint)") at ./assert/assert.c:101
      #10 0x0000563cdfe939d9 in compare_table_with_partition (thd=0x62b00005b208, table=0x62000003c088, part_table=0x620000040088, part_elem=0x61d00020faf0, part_id=0) at /data/bld/10.4-asan/sql/sql_partition_admin.cc:260
      #11 0x0000563cdfe95bd8 in Sql_cmd_alter_table_exchange_partition::exchange_partition (this=0x62b000063200, thd=0x62b00005b208, table_list=0x62b000062368, alter_info=0x7f80ccd62c40) at /data/bld/10.4-asan/sql/sql_partition_admin.cc:607
      #12 0x0000563cdfe9240d in Sql_cmd_alter_table_exchange_partition::execute (this=0x62b000063200, thd=0x62b00005b208) at /data/bld/10.4-asan/sql/sql_partition_admin.cc:100
      #13 0x0000563cdfaaa20f in mysql_execute_command (thd=0x62b00005b208) at /data/bld/10.4-asan/sql/sql_parse.cc:6292
      #14 0x0000563cdfab5b63 in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2", length=50, parser_state=0x7f80ccd64c60, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:8088
      #15 0x0000563cdfa8b782 in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x62900021c209 "ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2", packet_length=50, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:1857
      #16 0x0000563cdfa882f1 in do_command (thd=0x62b00005b208) at /data/bld/10.4-asan/sql/sql_parse.cc:1378
      #17 0x0000563cdfe8f80b in do_handle_one_connection (connect=0x6080000009a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1419
      #18 0x0000563cdfe8f122 in handle_one_connection (arg=0x6080000009a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1323
      #19 0x0000563ce0af5664 in pfs_spawn_thread (arg=0x615000003508) at /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
      #20 0x00007f80d5ea8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #21 0x00007f80d5f2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      A non-debug build doesn't visibly fail with the provided test case; however, the behavior is weird in general. For example, if I add DELAY_KEY_WRITE=1 table option to the table definitions instead (or even in addition to!) changing the variable value, it doesn't fail:

      SET @delay.save= @@delay_key_write;
      SET GLOBAL delay_key_write= ALL;
      connect  con1,localhost,root,,;
      CREATE TABLE t1 (a INT) ENGINE=Aria DELAY_KEY_WRITE=1 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100));
      CREATE TABLE t2 (a INT) ENGINE=Aria DELAY_KEY_WRITE=1;
      connection default;
      ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
      DROP TABLE t1, t2;
      SET GLOBAL delay_key_write= @delay.save;
      

      Or, if EXCHANGE is done in the same connection as the previous table creation, it triggers an unexpected ER_TABLES_DIFFERENT_METADATA:

      SET @delay.save= @@delay_key_write;
      SET GLOBAL delay_key_write= ALL;
      connect  con1,localhost,root,,;
      CREATE TABLE t1 (a INT) ENGINE=Aria PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (100));
      CREATE TABLE t2 LIKE t1;
      ALTER TABLE t2 REMOVE PARTITIONING;
      ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
      bug.r8                                   [ fail ]
              Test ended at 2024-02-26 01:09:19
       
      CURRENT_TEST: bug.r8
      mysqltest: At line 10: query 'ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2' failed: 1736: Tables have different definitions
      

      etc.

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.