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

Server crashes in innobase_strcasecmp / dict_foreign_find_index upon 3rd ALTER

    XMLWordPrintable

    Details

      Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b INT, KEY(b)) ENGINE=InnoDB;
      CREATE TABLE t2 (
        id INT,
        c INT, d INT, e INT,
        f TIMESTAMP,
        g TIMESTAMP,
        PRIMARY KEY(id, g),
        KEY(c), KEY (id), KEY (e),
        FOREIGN KEY (d) REFERENCES t1 (b),
        FOREIGN KEY fk (c) REFERENCES t2 (id)
      ) ENGINE=InnoDB;
       
      SET FOREIGN_KEY_CHECKS= OFF;
      ALTER TABLE t2 DROP INDEX c;
      ALTER TABLE t2 DROP PRIMARY KEY;
       
      ALTER TABLE t1 CHANGE COLUMN b x INT;
       
      # Cleanup
      DROP TABLE IF EXISTS t2, t1;
      

      10.2 96dd4b53

      #3  <signal handler called>
      #4  0x000055bb89dc1b40 in my_strcasecmp_utf8 (cs=0x55bb8a6d2460 <my_charset_utf8_general_ci>, s=0x7f29e0039a20 "d", t=0x8 <error: Cannot access memory at address 0x8>) at /data/src/10.2/strings/ctype-utf8.c:5298
      #5  0x000055bb89822361 in innobase_strcasecmp (a=0x7f29e0039a20 "d", b=0x8 <error: Cannot access memory at address 0x8>) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:2280
      #6  0x000055bb89aed2bb in dict_foreign_qualify_index (table=0x7f29e0191ed0, col_names=0x7f29e003d7b0, columns=0x7f29e00399c0, n_cols=1, index=0x7f29e0035df0, types_idx=0x7f29e00ab2c0, check_charsets=true, check_null=0, error=0x0, err_col_no=0x0, err_index=0x0) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:6498
      #7  0x000055bb89ae44ad in dict_foreign_find_index (table=0x7f29e0191ed0, col_names=0x7f29e003d7b0, columns=0x7f29e00399c0, n_cols=1, types_idx=0x7f29e00ab2c0, check_charsets=true, check_null=0, error=0x0, err_col_no=0x0, err_index=0x0) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:2983
      #8  0x000055bb89ae4a51 in dict_foreign_add_to_cache (foreign=0x7f29e0039930, col_names=0x7f29e003d7b0, check_charsets=true, ignore_err=DICT_ERR_IGNORE_NONE) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:3130
      #9  0x000055bb89afd995 in dict_load_foreign (id=0x7f2a360e9ad0 "test/t2_ibfk_1", col_names=0x7f29e003d7b0, check_recursive=false, check_charsets=true, ignore_err=DICT_ERR_IGNORE_NONE, fk_tables=std::deque with 0 elements) at /data/src/10.2/storage/innobase/dict/dict0load.cc:3560
      #10 0x000055bb89afdf09 in dict_load_foreigns (table_name=0x7f29e0175090 "test/t1", col_names=0x7f29e003d7b0, check_recursive=false, check_charsets=true, ignore_err=DICT_ERR_IGNORE_NONE, fk_tables=std::deque with 0 elements) at /data/src/10.2/storage/innobase/dict/dict0load.cc:3700
      #11 0x000055bb8986d467 in innobase_update_foreign_cache (ctx=0x7f29e0014098, user_thd=0x7f29e0000d90) at /data/src/10.2/storage/innobase/handler/handler0alter.cc:7496
      #12 0x000055bb8986f6c2 in ha_innobase::commit_inplace_alter_table (this=0x7f29e0179698, altered_table=0x7f29e003bb60, ha_alter_info=0x7f2a360eb090, commit=true) at /data/src/10.2/storage/innobase/handler/handler0alter.cc:8684
      #13 0x000055bb8962bd90 in handler::ha_commit_inplace_alter_table (this=0x7f29e0179698, altered_table=0x7f29e003bb60, ha_alter_info=0x7f2a360eb090, commit=true) at /data/src/10.2/sql/handler.cc:4386
      #14 0x000055bb89473e74 in mysql_inplace_alter_table (thd=0x7f29e0000d90, table_list=0x7f29e00127e8, table=0x7f29e009ced0, altered_table=0x7f29e003bb60, ha_alter_info=0x7f2a360eb090, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f2a360eb120, alter_ctx=0x7f2a360eb6d0) at /data/src/10.2/sql/sql_table.cc:7485
      #15 0x000055bb89479bb4 in mysql_alter_table (thd=0x7f29e0000d90, new_db=0x7f29e0012e00 "test", new_name=0x0, create_info=0x7f2a360ec2f0, table_list=0x7f29e00127e8, alter_info=0x7f2a360ec240, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9627
      #16 0x000055bb894f829e in Sql_cmd_alter_table::execute (this=0x7f29e0012ef8, thd=0x7f29e0000d90) at /data/src/10.2/sql/sql_alter.cc:333
      #17 0x000055bb893a65d5 in mysql_execute_command (thd=0x7f29e0000d90) at /data/src/10.2/sql/sql_parse.cc:6020
      #18 0x000055bb893ab43b in mysql_parse (thd=0x7f29e0000d90, rawbuf=0x7f29e00126f8 "ALTER TABLE t1 CHANGE COLUMN b x INT", length=36, parser_state=0x7f2a360ed5f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7794
      #19 0x000055bb89399664 in dispatch_command (command=COM_QUERY, thd=0x7f29e0000d90, packet=0x7f29e0008b51 "ALTER TABLE t1 CHANGE COLUMN b x INT", packet_length=36, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #20 0x000055bb8939815f in do_command (thd=0x7f29e0000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #21 0x000055bb894f2c94 in do_handle_one_connection (connect=0x55bb8c3f8810) at /data/src/10.2/sql/sql_connect.cc:1336
      #22 0x000055bb894f29f9 in handle_one_connection (arg=0x55bb8c3f8810) at /data/src/10.2/sql/sql_connect.cc:1241
      #23 0x000055bb89d1bfb8 in pfs_spawn_thread (arg=0x55bb8c3dbc00) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #24 0x00007f2a3c197609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #25 0x00007f2a3bd71293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.2-10.6 (with the usual my_strcasecmp_utf8 => my_strcasecmp_utf8mb3 difference), on debug, release and ASAN builds alike.

      The scenario started crashing after this commit:

      commit 8268f26605c871f19cb78be08c84f621f4e0c4cb
      Author: Thirunarayanan Balathandayuthapani
      Date:   Fri Aug 7 19:02:48 2020 +0530
       
          MDEV-22934 Table disappear after two alter table command
      

      However, I wouldn't call it a regression – it was failing anyway, just with different symptoms (similar to MDEV-22934).

        Attachments

          Activity

            People

            Assignee:
            thiru Thirunarayanan Balathandayuthapani
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration