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

Server crashes when a adding column to the table which has a primary key using hash

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (a INT,PRIMARY KEY USING HASH (a)) ENGINE=INNODB;
      ALTER TABLE t ADD b INT;
       
      # Cleanup
      DROP TABLE t;
      

      Leads to:

      CS 11.7.1 54ab281de85f53e4fa7ba07384bed388737681e6 (Debug)

      mariadbd: /test/11.7_dbg/storage/innobase/handler/handler0alter.cc:3887: void innobase_create_index_def(const TABLE*, const KEY*, ulint, bool, bool, index_def_t*, mem_heap_t*): Assertion `key->algorithm <= HA_KEY_ALG_BTREE' failed.
      

      CS 11.7.1 54ab281de85f53e4fa7ba07384bed388737681e6 (Debug)

      Core was generated by `/test/MD141124-mariadb-11.7.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x1538c0aef700 (LWP 3248399))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00001538d9b82859 in __GI_abort () at abort.c:79
      #2  0x00001538d9b82729 in __assert_fail_base (fmt=0x1538d9d18588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56109f64c7d0 "key->algorithm <= HA_KEY_ALG_BTREE", file=0x56109f6477b0 "/test/11.7_dbg/storage/innobase/handler/handler0alter.cc", line=3887, function=<optimized out>) at assert.c:92
      #3  0x00001538d9b93fd6 in __GI___assert_fail (assertion=assertion@entry=0x56109f64c7d0 "key->algorithm <= HA_KEY_ALG_BTREE", file=file@entry=0x56109f6477b0 "/test/11.7_dbg/storage/innobase/handler/handler0alter.cc", line=line@entry=3887, function=function@entry=0x56109f64c768 "void innobase_create_index_def(const TABLE*, const KEY*, ulint, bool, bool, index_def_t*, mem_heap_t*)") at assert.c:101
      #4  0x000056109edf5964 in innobase_create_index_def (altered_table=altered_table@entry=0x1538c0ae6370, keys=keys@entry=0x15389401bf08, key_number=key_number@entry=0, new_clustered=new_clustered@entry=true, key_clustered=key_clustered@entry=true, index=index@entry=0x153894036810, heap=0x153894036640) at /test/11.7_dbg/storage/innobase/handler/handler0alter.cc:3887
      #5  0x000056109edfacf6 in ha_innobase_inplace_ctx::create_key_defs (this=this@entry=0x15389401c1e0, ha_alter_info=ha_alter_info@entry=0x1538c0ae62b0, altered_table=altered_table@entry=0x1538c0ae6370, n_fts_add=@0x1538c0ae4990: 0, fts_doc_id_col=@0x1538c0ae51a0: 18446744073709551615, add_fts_doc_id=@0x1538c0ae498c: false, add_fts_doc_idx=@0x1538c0ae4988: false, table=0x153894029ea8) at /test/11.7_dbg/storage/innobase/handler/handler0alter.cc:4195
      #6  0x000056109ede4584 in prepare_inplace_alter_table_dict (ha_alter_info=ha_alter_info@entry=0x1538c0ae62b0, altered_table=altered_table@entry=0x1538c0ae6370, old_table=0x153894029ea8, table_name=0x153894022d35 "t", flags=33, flags2=80, fts_doc_id_col=<optimized out>, add_fts_doc_id=<optimized out>, add_fts_doc_id_idx=<optimized out>) at /test/11.7_dbg/storage/innobase/handler/handler0alter.cc:6559
      #7  0x000056109edf0414 in ha_innobase::prepare_inplace_alter_table (this=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>) at /test/11.7_dbg/storage/innobase/handler/ha_innodb.h:699
      #8  0x000056109ea96a1f in handler::ha_prepare_inplace_alter_table (this=0x15389402a710, altered_table=altered_table@entry=0x1538c0ae6370, ha_alter_info=ha_alter_info@entry=0x1538c0ae62b0) at /test/11.7_dbg/sql/handler.cc:5679
      #9  0x000056109e83d3f2 in mysql_inplace_alter_table (thd=thd@entry=0x153894000d48, table_list=0x15389401a968, table=table@entry=0x153894029ea8, altered_table=altered_table@entry=0x1538c0ae6370, ha_alter_info=ha_alter_info@entry=0x1538c0ae62b0, target_mdl_request=target_mdl_request@entry=0x1538c0ae6bf0, ddl_log_state=0x1538c0ae6220, trigger_param=0x1538c0ae6780, alter_ctx=0x1538c0ae8d80, partial_alter=@0x1538c0ae6177: false, start_alter_id=@0x1538c0ae6180: 0, if_exists=false) at /test/11.7_dbg/sql/sql_table.cc:7986
      #10 0x000056109e856b32 in mysql_alter_table (thd=thd@entry=0x153894000d48, new_db=new_db@entry=0x153894005960, new_name=new_name@entry=0x153894005dc0, create_info=create_info@entry=0x1538c0aed250, table_list=<optimized out>, table_list@entry=0x15389401a968, recreate_info=recreate_info@entry=0x1538c0aed0c0, alter_info=<optimized out>, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>, if_exists=<optimized out>) at /test/11.7_dbg/sql/sql_table.cc:11476
      #11 0x000056109e8e558c in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x153894000d48) at /test/11.7_dbg/sql/structs.h:607
      #12 0x000056109e7566c6 in mysql_execute_command (thd=thd@entry=0x153894000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.7_dbg/sql/sql_parse.cc:5872
      #13 0x000056109e741679 in mysql_parse (thd=thd@entry=0x153894000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1538c0aee300) at /test/11.7_dbg/sql/sql_parse.cc:7901
      #14 0x000056109e758bb7 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153894000d48, packet=packet@entry=0x15389400b099 "ALTER TABLE t ADD b INT", packet_length=packet_length@entry=23, blocking=blocking@entry=true) at /test/11.7_dbg/sql/sql_class.h:1656
      #15 0x000056109e75b40a in do_command (thd=thd@entry=0x153894000d48, blocking=blocking@entry=true) at /test/11.7_dbg/sql/sql_parse.cc:1416
      #16 0x000056109e8de2e9 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5610a2295588, put_in_cache=put_in_cache@entry=true) at /test/11.7_dbg/sql/sql_connect.cc:1438
      #17 0x000056109e8de7c3 in handle_one_connection (arg=0x5610a2295588) at /test/11.7_dbg/sql/sql_connect.cc:1350
      #18 0x00001538da0ae609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #19 0x00001538d9c7f133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 11.7.1 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.28 (dbg), 10.5.28 (opt), 10.6.21 (dbg), 10.6.21 (opt), 10.11.11 (dbg), 10.11.11 (opt), 11.2.6 (dbg), 11.2.6 (opt), 11.4.5 (dbg), 11.4.5 (opt), 11.6.2 (dbg), 11.6.2 (opt), 11.7.1 (opt)

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              ramesh Ramesh Sivaraman
              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.