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

Server crash or assertion failure after adding a unique key on a blob

    XMLWordPrintable

Details

    Description

      I'm not sure why such an ugly way of adding a unique key is required (via a SERIAL column – while the column isn't added since it already exists, the unique key is); but adding just a unique key directly doesn't cause the same effect.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, a VARCHAR(150), b TEXT, KEY(a(64))) ENGINE=InnoDB;
      ALTER TABLE t1 ADD IF NOT EXISTS b SERIAL, ORDER BY b;
      ALTER TABLE t1 FORCE;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 04ad98b5 debug

      mysqld: /data/src/10.4/sql/table.cc:9234: void setup_keyinfo_hash(KEY*): Assertion `key_info->key_part->field->flags & (1<< 30)' failed.
      211109 19:19:56 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f0c4368bf36 in __GI___assert_fail (assertion=0x55d04488e7e8 "key_info->key_part->field->flags & (1<< 30)", file=0x55d04488b060 "/data/src/10.4/sql/table.cc", line=9234, function=0x55d04488e784 "void setup_keyinfo_hash(KEY*)") at assert.c:101
      #8  0x000055d043c9128b in setup_keyinfo_hash (key_info=0x7f0bec096028) at /data/src/10.4/sql/table.cc:9234
      #9  0x000055d043c40559 in mysql_prepare_alter_table (thd=0x7f0bec000d90, table=0x7f0bec192c60, create_info=0x7f0c3c7052b0, alter_info=0x7f0c3c7051f0, alter_ctx=0x7f0c3c7046b0) at /data/src/10.4/sql/sql_table.cc:8531
      #10 0x000055d043c44b4d in mysql_alter_table (thd=0x7f0bec000d90, new_db=0x7f0bec005568, new_name=0x7f0bec005990, create_info=0x7f0c3c7052b0, table_list=0x7f0bec014868, alter_info=0x7f0c3c7051f0, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9970
      #11 0x000055d043ce0752 in Sql_cmd_alter_table::execute (this=0x7f0bec014f38, thd=0x7f0bec000d90) at /data/src/10.4/sql/sql_alter.cc:520
      #12 0x000055d043b544a9 in mysql_execute_command (thd=0x7f0bec000d90) at /data/src/10.4/sql/sql_parse.cc:6192
      #13 0x000055d043b59897 in mysql_parse (thd=0x7f0bec000d90, rawbuf=0x7f0bec014798 "ALTER TABLE t1 FORCE", length=20, parser_state=0x7f0c3c7064d0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7995
      #14 0x000055d043b45b9f in dispatch_command (command=COM_QUERY, thd=0x7f0bec000d90, packet=0x7f0bec00abf1 "ALTER TABLE t1 FORCE", packet_length=20, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #15 0x000055d043b44405 in do_command (thd=0x7f0bec000d90) at /data/src/10.4/sql/sql_parse.cc:1373
      #16 0x000055d043cd6ee4 in do_handle_one_connection (connect=0x55d0468de070) at /data/src/10.4/sql/sql_connect.cc:1420
      #17 0x000055d043cd6b7d in handle_one_connection (arg=0x55d0468de070) at /data/src/10.4/sql/sql_connect.cc:1316
      #18 0x000055d04420abf4 in pfs_spawn_thread (arg=0x55d04682a790) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #19 0x00007f0c43ba4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x00007f0c43777293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.4 04ad98b5 non-debug

      #3  <signal handler called>
      #4  0x00005589ea635482 in fields_in_hash_keyinfo (keyinfo=keyinfo@entry=0x7f59f812d410) at /data/src/10.4/sql/item.h:2694
      #5  0x00005589ea6354a5 in setup_keyinfo_hash (key_info=key_info@entry=0x7f59f812d410) at /data/src/10.4/sql/table.cc:9235
      #6  0x00005589ea60027f in mysql_prepare_alter_table (thd=<optimized out>, table=<optimized out>, create_info=<optimized out>, alter_info=<optimized out>, alter_ctx=<optimized out>) at /data/src/10.4/sql/sql_table.cc:8531
      #7  0x00005589ea606a0c in mysql_alter_table (thd=thd@entry=0x7f59f8000c48, new_db=new_db@entry=0x7f59f8005260, new_name=new_name@entry=0x7f59f8005688, create_info=create_info@entry=0x7f5a463062a0, table_list=<optimized out>, table_list@entry=0x7f59f8010180, alter_info=alter_info@entry=0x7f5a463061e0, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9970
      #8  0x00005589ea661def in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x7f59f8000c48) at /data/src/10.4/sql/sql_alter.cc:520
      #9  0x00005589ea55cc60 in mysql_execute_command (thd=0x7f59f8000c48) at /data/src/10.4/sql/sql_parse.cc:6192
      #10 0x00005589ea563f43 in mysql_parse (thd=0x7f59f8000c48, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.4/sql/sql_parse.cc:7995
      #11 0x00005589ea56661d in dispatch_command (command=COM_QUERY, thd=0x7f59f8000c48, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.4/sql/sql_class.h:1201
      #12 0x00005589ea568cb0 in do_command (thd=0x7f59f8000c48) at /data/src/10.4/sql/sql_parse.cc:1373
      #13 0x00005589ea65d87e in do_handle_one_connection (connect=connect@entry=0x5589ed9950d8) at /data/src/10.4/sql/sql_connect.cc:1420
      #14 0x00005589ea65d9af in handle_one_connection (arg=arg@entry=0x5589ed9950d8) at /data/src/10.4/sql/sql_connect.cc:1316
      #15 0x00005589ea9f2686 in pfs_spawn_thread (arg=0x5589ed6c4568) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #16 0x00007f5a517d9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #17 0x00007f5a513c7293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      The failures appeared in 10.4 after the merge from 10.3

      commit 47ab793d71f2755b026672e4657174a1740b6ae2 (HEAD)
      Merge: de2fa9eced7 524b4a89da3
      Author: Marko Mäkelä
      Date:   Tue Nov 9 08:40:14 2021 +0200
       
          Merge 10.3 into 10.4
      

      but given that 10.3 doesn't have unique blobs, it doesn't fail there.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.