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

Server crash when renaming the column when FOREIGN_KEY_CHECKS is disabled

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB;
      ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1);
      ALTER TABLE t1 ADD COLUMN f INT;
      SET FOREIGN_KEY_CHECKS= OFF;
      ALTER TABLE t1 DROP KEY idx;
      ALTER TABLE t1 ADD KEY idx (f1);
      SET FOREIGN_KEY_CHECKS= ON;
      ALTER TABLE t1 DROP f3;
      ALTER TABLE t1 CHANGE f f3 INT;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 a5ac029f non-debug

      190331 19:44:20 [ERROR] mysqld got signal 11 ;
       
      #2  <signal handler called>
      #3  0x000055e3d35201bd in operator char const* (this=<optimized out>) at /data/src/10.4/storage/innobase/include/dict0mem.h:519
      #4  dict_mem_table_col_rename_low (is_virtual=<optimized out>, s=<optimized out>, to=0x7f5c7c083960 "\001", i=<optimized out>, table=0x7f5c7c08f9e0) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:642
      #5  dict_mem_table_col_rename (table=0x7f5c7c08f9e0, nth_col=<optimized out>, from=<optimized out>, to=<optimized out>, is_virtual=<optimized out>) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:690
      #6  0x000055e3d3387dde in innobase_rename_or_enlarge_columns_cache (user_table=<optimized out>, table=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:9235
      #7  commit_cache_norebuild (ha_alter_info=ha_alter_info@entry=0x7f5cd5be8e20, ctx=ctx@entry=0x7f5c7c013af8, altered_table=altered_table@entry=0x7f5c7c049138, table=<optimized out>, trx=<optimized out>) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10362
      #8  0x000055e3d338027c in ha_innobase::commit_inplace_alter_table (this=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>, commit=<optimized out>) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:11037
      #9  0x000055e3d2e567be in mysql_inplace_alter_table (thd=thd@entry=0x7f5c7c0009a8, table_list=0x7f5c7c012038, table=table@entry=0x7f5c7c0892f8, altered_table=altered_table@entry=0x7f5c7c049138, ha_alter_info=ha_alter_info@entry=0x7f5cd5be8e20, inplace_supported=inplace_supported@entry=HA_ALTER_INPLACE_INSTANT, alter_ctx=0x7f5cd5be9670, target_mdl_request=0x7f5cd5be8ec0) at /data/src/10.4/sql/sql_table.cc:7696
      #10 0x000055e3d2fe29b1 in mysql_alter_table (thd=<optimized out>, new_db=<optimized out>, new_name=<optimized out>, create_info=<optimized out>, table_list=0x7f5c7c012038, alter_info=0x7f5cd5bea170, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9934
      #11 0x000055e3d3033aca in Sql_cmd_alter_table::execute (this=0x7f5c7c0930f0, thd=0x7f5c7c0009a8) at /data/src/10.4/sql/sql_alter.cc:496
      #12 0x000055e3d2f4975d in mysql_execute_command (thd=thd@entry=0x7f5c7c0009a8) at /data/src/10.4/sql/sql_parse.cc:6344
      #13 0x000055e3d2f504e1 in mysql_parse (thd=thd@entry=0x7f5c7c0009a8, rawbuf=<optimized out>, length=30, parser_state=parser_state@entry=0x7f5cd5bed1d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #14 0x000055e3d2f52992 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f5c7c0009a8, packet=packet@entry=0x7f5c7c009be9 "ALTER TABLE t1 CHANGE f f3 INT", packet_length=packet_length@entry=30, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #15 0x000055e3d2f540b7 in do_command (thd=0x7f5c7c0009a8) at /data/src/10.4/sql/sql_parse.cc:1365
      #16 0x000055e3d302f6dc in do_handle_one_connection (connect=connect@entry=0x55e3d5970688) at /data/src/10.4/sql/sql_connect.cc:1398
      #17 0x000055e3d302f844 in handle_one_connection (arg=arg@entry=0x55e3d5970688) at /data/src/10.4/sql/sql_connect.cc:1301
      #18 0x000055e3d334ba44 in pfs_spawn_thread (arg=0x55e3d59706e8) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #19 0x00007f5cddf65494 in start_thread (arg=0x7f5cd5bee700) at pthread_create.c:333
      #20 0x00007f5cdc13393f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.4 a5ac029f debug

      mysqld: /data/src/10.4/storage/innobase/dict/dict0mem.cc:633: void dict_mem_table_col_rename_low(dict_table_t*, unsigned int, const char*, const char*, bool): Assertion `foreign->referenced_index != __null' failed.
      190331 19:43:50 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f3aa29b8ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055f04330ce14 in dict_mem_table_col_rename_low (table=0x7f3a5013b578, i=6, to=0x7f3a5005e0b7 "f3", s=0x7f3a501550c8 "\003\004", is_virtual=false) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:633
      #9  0x000055f04330d1ae in dict_mem_table_col_rename (table=0x7f3a5013b578, nth_col=2, from=0x7f3a5013cbe7 "f", to=0x7f3a5005e0b7 "f3", is_virtual=false) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:690
      #10 0x000055f04304e5b2 in innobase_rename_or_enlarge_columns_cache (ha_alter_info=0x7f3a9c52e7b0, altered_table=0x7f3a500788f0, table=0x7f3a50063c00, user_table=0x7f3a5013b578) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:9235
      #11 0x000055f043060197 in commit_cache_norebuild (ha_alter_info=0x7f3a9c52e7b0, ctx=0x7f3a50017180, altered_table=0x7f3a500788f0, table=0x7f3a50063c00, trx=0x7f3a9c7c9268) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10362
      #12 0x000055f043051b75 in ha_innobase::commit_inplace_alter_table (this=0x7f3a5005f148, altered_table=0x7f3a500788f0, ha_alter_info=0x7f3a9c52e7b0, commit=true) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:11037
      #13 0x000055f042cd22cc in handler::ha_commit_inplace_alter_table (this=0x7f3a5005f148, altered_table=0x7f3a500788f0, ha_alter_info=0x7f3a9c52e7b0, commit=true) at /data/src/10.4/sql/handler.cc:4712
      #14 0x000055f042a65803 in mysql_inplace_alter_table (thd=0x7f3a50000b00, table_list=0x7f3a500156c0, table=0x7f3a50063c00, altered_table=0x7f3a500788f0, ha_alter_info=0x7f3a9c52e7b0, inplace_supported=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x7f3a9c52e9a0, alter_ctx=0x7f3a9c52f100) at /data/src/10.4/sql/sql_table.cc:7696
      #15 0x000055f042a6beac in mysql_alter_table (thd=0x7f3a50000b00, new_db=0x7f3a50005298, new_name=0x7f3a50005698, create_info=0x7f3a9c52fcf0, table_list=0x7f3a500156c0, alter_info=0x7f3a9c52fc30, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9934
      #16 0x000055f042afd71b in Sql_cmd_alter_table::execute (this=0x7f3a50015e98, thd=0x7f3a50000b00) at /data/src/10.4/sql/sql_alter.cc:496
      #17 0x000055f04298b49e in mysql_execute_command (thd=0x7f3a50000b00) at /data/src/10.4/sql/sql_parse.cc:6344
      #18 0x000055f042990642 in mysql_parse (thd=0x7f3a50000b00, rawbuf=0x7f3a500155d8 "ALTER TABLE t1 CHANGE f f3 INT", length=30, parser_state=0x7f3a9c531180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #19 0x000055f04297bdd2 in dispatch_command (command=COM_QUERY, thd=0x7f3a50000b00, packet=0x7f3a5000a891 "ALTER TABLE t1 CHANGE f f3 INT", packet_length=30, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #20 0x000055f04297a5b8 in do_command (thd=0x7f3a50000b00) at /data/src/10.4/sql/sql_parse.cc:1365
      #21 0x000055f042af43d5 in do_handle_one_connection (connect=0x55f0464325f0) at /data/src/10.4/sql/sql_connect.cc:1398
      #22 0x000055f042af4146 in handle_one_connection (arg=0x55f0464325f0) at /data/src/10.4/sql/sql_connect.cc:1301
      #23 0x000055f042fe9e5d in pfs_spawn_thread (arg=0x55f046478450) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #24 0x00007f3aa48a7494 in start_thread (arg=0x7f3a9c532700) at pthread_create.c:333
      #25 0x00007f3aa2a7593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Not reproducible on 10.3.

      Slightly different test case with a slightly different assertion failure:

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (f1 INT, f2 INT, KEY idx(f1)) ENGINE=InnoDB;
      SET FOREIGN_KEY_CHECKS= OFF;
      ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES x (x);
      ALTER TABLE t1 ADD COLUMN f INT;
      ALTER TABLE t1 DROP KEY idx;
      ALTER TABLE t1 DROP f2;
      ALTER TABLE t1 CHANGE f f2 INT;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 a5ac029f debug

      mysqld: /data/src/10.4/storage/innobase/dict/dict0mem.cc:608: void dict_mem_table_col_rename_low(dict_table_t*, unsigned int, const char*, const char*, bool): Assertion `new_index != __null' failed.
      190331 19:56:57 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f7a77500ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000560c5368ecc5 in dict_mem_table_col_rename_low (table=0x7f7a2419b8c8, i=5, to=0x7f7a24072f84 "f2", s=0x7f7a2419be05 "", is_virtual=false) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:608
      #9  0x0000560c5368f1ae in dict_mem_table_col_rename (table=0x7f7a2419b8c8, nth_col=1, from=0x7f7a2419cb64 "f", to=0x7f7a24072f84 "f2", is_virtual=false) at /data/src/10.4/storage/innobase/dict/dict0mem.cc:690
      #10 0x0000560c533d05b2 in innobase_rename_or_enlarge_columns_cache (ha_alter_info=0x7f7a708767b0, altered_table=0x7f7a24071b00, table=0x7f7a24150720, user_table=0x7f7a2419b8c8) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:9235
      #11 0x0000560c533e2197 in commit_cache_norebuild (ha_alter_info=0x7f7a708767b0, ctx=0x7f7a24016c28, altered_table=0x7f7a24071b00, table=0x7f7a24150720, trx=0x7f7a71311268) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:10362
      #12 0x0000560c533d3b75 in ha_innobase::commit_inplace_alter_table (this=0x7f7a24151588, altered_table=0x7f7a24071b00, ha_alter_info=0x7f7a708767b0, commit=true) at /data/src/10.4/storage/innobase/handler/handler0alter.cc:11037
      #13 0x0000560c530542cc in handler::ha_commit_inplace_alter_table (this=0x7f7a24151588, altered_table=0x7f7a24071b00, ha_alter_info=0x7f7a708767b0, commit=true) at /data/src/10.4/sql/handler.cc:4712
      #14 0x0000560c52de7803 in mysql_inplace_alter_table (thd=0x7f7a24000b00, table_list=0x7f7a240156c0, table=0x7f7a24150720, altered_table=0x7f7a24071b00, ha_alter_info=0x7f7a708767b0, inplace_supported=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x7f7a708769a0, alter_ctx=0x7f7a70877100) at /data/src/10.4/sql/sql_table.cc:7696
      #15 0x0000560c52dedeac in mysql_alter_table (thd=0x7f7a24000b00, new_db=0x7f7a24005298, new_name=0x7f7a24005698, create_info=0x7f7a70877cf0, table_list=0x7f7a240156c0, alter_info=0x7f7a70877c30, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9934
      #16 0x0000560c52e7f71b in Sql_cmd_alter_table::execute (this=0x7f7a24015e98, thd=0x7f7a24000b00) at /data/src/10.4/sql/sql_alter.cc:496
      #17 0x0000560c52d0d49e in mysql_execute_command (thd=0x7f7a24000b00) at /data/src/10.4/sql/sql_parse.cc:6344
      #18 0x0000560c52d12642 in mysql_parse (thd=0x7f7a24000b00, rawbuf=0x7f7a240155d8 "ALTER TABLE t1 CHANGE f f2 INT", length=30, parser_state=0x7f7a70879180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #19 0x0000560c52cfddd2 in dispatch_command (command=COM_QUERY, thd=0x7f7a24000b00, packet=0x7f7a2400a891 "ALTER TABLE t1 CHANGE f f2 INT", packet_length=30, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #20 0x0000560c52cfc5b8 in do_command (thd=0x7f7a24000b00) at /data/src/10.4/sql/sql_parse.cc:1365
      #21 0x0000560c52e763d5 in do_handle_one_connection (connect=0x560c568c42c0) at /data/src/10.4/sql/sql_connect.cc:1398
      #22 0x0000560c52e76146 in handle_one_connection (arg=0x560c568c42c0) at /data/src/10.4/sql/sql_connect.cc:1301
      #23 0x0000560c5336be5d in pfs_spawn_thread (arg=0x560c5690a120) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #24 0x00007f7a793ef494 in start_thread (arg=0x7f7a7087a700) at pthread_create.c:333
      #25 0x00007f7a775bd93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.