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

Server crashes in dict_col_get_no after failed attempt to create unique key on virtual column

    XMLWordPrintable

    Details

      Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b INT AS (a)) ENGINE=InnODB;
       
      INSERT INTO t1 (pk,a) VALUES (1,10),(2,10);
      --error ER_DUP_ENTRY
      ALTER TABLE t1 ADD UNIQUE INDEX ind9 (b), LOCK=SHARED;
      SET FOREIGN_KEY_CHECKS= 0;
      ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (pk);
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 c029d456

      #3  <signal handler called>
      #4  0x00005621b0636177 in dict_col_get_no (col=0x0) at /data/src/10.2/storage/innobase/include/dict0dict.ic:150
      #5  0x00005621b064872d in dict_foreign_qualify_index (table=0x7f24a0174ff0, col_names=0x0, columns=0x7f2501ac0920, n_cols=1, index=0x7f24a00a2730, types_idx=0x0, 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:6622
      #6  0x00005621b03be6a9 in innobase_find_fk_index (ha_alter_info=0x7f2501ac3020, table=0x7f24a0174ff0, col_names=0x0, drop_index=..., columns=0x7f2501ac0920, n_cols=1) at /data/src/10.2/storage/innobase/handler/handler0alter.cc:1365
      #7  0x00005621b03bebbc in innobase_get_foreign_key_info (ha_alter_info=0x7f2501ac3020, table_share=0x7f24a00aa128, table=0x7f24a0174ff0, col_names=0x0, drop_index=0x0, n_drop_index=0, add_fk=0x7f24a009e980, n_add_fk=0x7f2501ac2b90, trx=0x7f2502687140, s_cols=0x0) at /data/src/10.2/storage/innobase/handler/handler0alter.cc:1516
      #8  0x00005621b03ca314 in ha_innobase::prepare_inplace_alter_table (this=0x7f24a0036e18, altered_table=0x7f24a0190ae0, ha_alter_info=0x7f2501ac3020) at /data/src/10.2/storage/innobase/handler/handler0alter.cc:5861
      #9  0x00005621b018da19 in handler::ha_prepare_inplace_alter_table (this=0x7f24a0036e18, altered_table=0x7f24a0190ae0, ha_alter_info=0x7f2501ac3020) at /data/src/10.2/sql/handler.cc:4358
      #10 0x00005621affd670a in mysql_inplace_alter_table (thd=0x7f24a0000d90, table_list=0x7f24a0012810, table=0x7f24a00ad630, altered_table=0x7f24a0190ae0, ha_alter_info=0x7f2501ac3020, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f2501ac30b0, alter_ctx=0x7f2501ac3660) at /data/src/10.2/sql/sql_table.cc:7420
      #11 0x00005621affdc72f in mysql_alter_table (thd=0x7f24a0000d90, new_db=0x7f24a0012e28 "test", new_name=0x0, create_info=0x7f2501ac4280, table_list=0x7f24a0012810, alter_info=0x7f2501ac41d0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9622
      #12 0x00005621b005a78e in Sql_cmd_alter_table::execute (this=0x7f24a0013028, thd=0x7f24a0000d90) at /data/src/10.2/sql/sql_alter.cc:333
      #13 0x00005621aff09991 in mysql_execute_command (thd=0x7f24a0000d90) at /data/src/10.2/sql/sql_parse.cc:5964
      #14 0x00005621aff0e9a7 in mysql_parse (thd=0x7f24a0000d90, rawbuf=0x7f24a00126f8 "ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (pk)", length=53, parser_state=0x7f2501ac55f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #15 0x00005621afefccb6 in dispatch_command (command=COM_QUERY, thd=0x7f24a0000d90, packet=0x7f24a0008b51 "ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (pk)", packet_length=53, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1823
      #16 0x00005621afefb7b1 in do_command (thd=0x7f24a0000d90) at /data/src/10.2/sql/sql_parse.cc:1377
      #17 0x00005621b0055183 in do_handle_one_connection (connect=0x5621b2a424d0) at /data/src/10.2/sql/sql_connect.cc:1336
      #18 0x00005621b0054ee8 in handle_one_connection (arg=0x5621b2a424d0) at /data/src/10.2/sql/sql_connect.cc:1241
      #19 0x00005621b0878148 in pfs_spawn_thread (arg=0x5621b2f30000) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #20 0x00007f2507b5d609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #21 0x00007f2507737103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.2+, debug and non-debug alike.
      Not reproducible on 10.1.

      The failure started happening on 10.2 after this commit:

      commit cb437417d2214474102a11f0a207bb3bc86252ee (HEAD)
      Author: Marko Mäkelä
      Date:   Tue May 19 12:33:47 2020 +0300
       
          MDEV-19114 gcol.innodb_virtual_debug: Assertion n_fields>0 failed
      

        Attachments

          Activity

            People

            Assignee:
            marko Marko Mäkelä
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: