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

Server crash in ha_partition::handle_pre_scan or Assertion `inited==NONE' failed

    XMLWordPrintable

    Details

      Description

      Note: There is a mix of everything in the test: long unique key, partitioning, locking, versioning, DDL. It's possible that versioning, for example, is unrelated, but I couldn't get rid of it in the test case.

      --source include/have_partition.inc
       
      CREATE TABLE t1 (a VARCHAR(4096), UNIQUE(a)) WITH SYSTEM VERSIONING PARTITION BY system_time INTERVAL 1 SECOND (PARTITION p1 HISTORY, PARTITION pn CURRENT);
      INSERT INTO t1 VALUES ('foo');
      FLUSH TABLES WITH READ LOCK;
       
      --connect (con1,localhost,root,,test)
      SET lock_wait_timeout= 2;
      --error ER_LOCK_WAIT_TIMEOUT
      ALTER TABLE xx MODIFY x INT;
       
      --connection default
      UNLOCK TABLES;
      REPLACE INTO t1 VALUES ('foo');
      ALTER TABLE t1 ADD PARTITION (PARTITION p2 HISTORY);
       
      # Cleanup
      --disconnect con1
      DROP TABLE t1;
      

      10.4 non-debug 7ea413ac

      #3  <signal handler called>
      #4  ha_partition::handle_pre_scan (this=this@entry=0x7fc0a40e96a0, reverse_order=reverse_order@entry=false, use_parallel=use_parallel@entry=false) at /data/src/10.4/sql/ha_partition.cc:7264
      #5  0x00005612136d1a20 in ha_partition::common_index_read (this=0x7fc0a40e96a0, buf=0x7fc0a4082300 "\374\003", have_start_key=<optimized out>) at /data/src/10.4/sql/ha_partition.cc:5702
      #6  0x000056121322d894 in handler::ha_index_read_map (this=this@entry=0x7fc0a40e96a0, buf=0x7fc0a4082300 "\374\003", key=key@entry=0x7fc0b513892f "", keypart_map=keypart_map@entry=18446744073709551615, find_flag=find_flag@entry=HA_READ_KEY_EXACT) at /data/src/10.4/sql/handler.cc:2884
      #7  0x000056121322e67e in check_duplicate_long_entry_key (table=table@entry=0x7fc0a40e0db8, h=h@entry=0x7fc0a40e96a0, new_rec=new_rec@entry=0x7fc0a4082300 "\374\003", key_no=key_no@entry=0) at /data/src/10.4/sql/handler.cc:6521
      #8  0x000056121323322d in check_duplicate_long_entries (new_rec=0x7fc0a4082300 "\374\003", h=0x7fc0a40e96a0, table=<optimized out>) at /data/src/10.4/sql/handler.cc:6591
      #9  handler::ha_write_row (this=0x7fc0a40123d8, buf=0x7fc0a4082300 "\374\003") at /data/src/10.4/sql/handler.cc:6672
      #10 0x00005612136d35cb in ha_partition::copy_partitions (this=this@entry=0x7fc0a40e96a0, copied=copied@entry=0x7fc0b5139008, deleted=deleted@entry=0x7fc0b5139010) at /data/src/10.4/sql/ha_partition.cc:2117
      #11 0x00005612136d3ee4 in ha_partition::change_partitions (this=<optimized out>, create_info=0x7fc0b513c1f0, path=0x7fc0b5138d60 "./test/t1", copied=0x7fc0b5139008, deleted=0x7fc0b5139010, pack_frm_data=<optimized out>, pack_frm_len=0) at /data/src/10.4/sql/ha_partition.cc:2029
      #12 0x00005612133596c5 in mysql_change_partitions (lpt=lpt@entry=0x7fc0b5139000) at /data/src/10.4/sql/sql_partition.cc:6072
      #13 0x0000561213362a9f in fast_alter_partition_table (thd=thd@entry=0x7fc0a40009a8, table=table@entry=0x7fc0a40e0db8, alter_info=alter_info@entry=0x7fc0b513c130, create_info=create_info@entry=0x7fc0b513c1f0, table_list=0x7fc0a400fef0, db=db@entry=0x7fc0b513b630, table_name=0x7fc0b513b640) at /data/src/10.4/sql/sql_partition.cc:7437
      #14 0x00005612130bffe0 in mysql_alter_table (thd=thd@entry=0x7fc0a40009a8, new_db=new_db@entry=0x7fc0a4004fa8, new_name=new_name@entry=0x7fc0a40053b0, create_info=create_info@entry=0x7fc0b513c1f0, table_list=<optimized out>, table_list@entry=0x7fc0a400fef0, alter_info=alter_info@entry=0x7fc0b513c130, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9864
      #15 0x000056121310f5a2 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x7fc0a40009a8) at /data/src/10.4/sql/sql_alter.cc:508
      #16 0x0000561213030fb0 in mysql_execute_command (thd=thd@entry=0x7fc0a40009a8) at /data/src/10.4/sql/sql_parse.cc:6102
      #17 0x00005612130381d9 in mysql_parse (thd=thd@entry=0x7fc0a40009a8, rawbuf=<optimized out>, length=65, parser_state=parser_state@entry=0x7fc0b513f1a0, 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:7901
      #18 0x000056121303a5d2 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fc0a40009a8, packet=packet@entry=0x7fc0a4007a19 "ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 HISTORY)", packet_length=packet_length@entry=65, 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:1842
      #19 0x000056121303bcf9 in do_command (thd=0x7fc0a40009a8) at /data/src/10.4/sql/sql_parse.cc:1360
      #20 0x000056121310b244 in do_handle_one_connection (connect=connect@entry=0x561214e17238) at /data/src/10.4/sql/sql_connect.cc:1412
      #21 0x000056121310b2f4 in handle_one_connection (arg=arg@entry=0x561214e17238) at /data/src/10.4/sql/sql_connect.cc:1316
      #22 0x00005612136b69f4 in pfs_spawn_thread (arg=0x561214dacea8) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #23 0x00007fc0bcef84a4 in start_thread (arg=0x7fc0b5140700) at pthread_create.c:456
      #24 0x00007fc0bb02cd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.4 debug 7ea413ac

      mysqld: /data/src/10.4/sql/handler.h:3191: int handler::ha_index_init(uint, bool): Assertion `inited==NONE' failed.
      200120 22:34:17 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f4a9a1cdf12 in __GI___assert_fail (assertion=0x55ee1d0a3a3a "inited==NONE", file=0x55ee1d0a3a0f "/data/src/10.4/sql/handler.h", line=3191, function=0x55ee1d0a7500 <handler::ha_index_init(unsigned int, bool)::__PRETTY_FUNCTION__> "int handler::ha_index_init(uint, bool)") at assert.c:101
      #8  0x000055ee1c311419 in handler::ha_index_init (this=0x7f4a84193978, idx=0, sorted=false) at /data/src/10.4/sql/handler.h:3191
      #9  0x000055ee1cf73943 in ha_partition::index_init (this=0x7f4a84078848, inx=0, sorted=false) at /data/src/10.4/sql/ha_partition.cc:5465
      #10 0x000055ee1c311439 in handler::ha_index_init (this=0x7f4a84078848, idx=0, sorted=false) at /data/src/10.4/sql/handler.h:3192
      #11 0x000055ee1c7333fb in check_duplicate_long_entry_key (table=0x7f4a840b34e0, h=0x7f4a84078848, new_rec=0x7f4a840740b8 "\374\003", key_no=0) at /data/src/10.4/sql/handler.cc:6516
      #12 0x000055ee1c733b2e in check_duplicate_long_entries (table=0x7f4a840b34e0, h=0x7f4a84078848, new_rec=0x7f4a840740b8 "\374\003") at /data/src/10.4/sql/handler.cc:6591
      #13 0x000055ee1c733e78 in handler::ha_write_row (this=0x7f4a840157b0, buf=0x7f4a840740b8 "\374\003") at /data/src/10.4/sql/handler.cc:6672
      #14 0x000055ee1cf69ee6 in ha_partition::copy_partitions (this=0x7f4a84078848, copied=0x7f4a9439b578, deleted=0x7f4a9439b580) at /data/src/10.4/sql/ha_partition.cc:2117
      #15 0x000055ee1cf69bd4 in ha_partition::change_partitions (this=0x7f4a84078848, create_info=0x7f4a9439dcf0, path=0x7f4a9439b2d0 "./test/t1", copied=0x7f4a9439b578, deleted=0x7f4a9439b580, pack_frm_data=0x0, pack_frm_len=0) at /data/src/10.4/sql/ha_partition.cc:2029
      #16 0x000055ee1c72e63c in handler::ha_change_partitions (this=0x7f4a84078848, create_info=0x7f4a9439dcf0, path=0x7f4a9439b2d0 "./test/t1", copied=0x7f4a9439b578, deleted=0x7f4a9439b580, pack_frm_data=0x0, pack_frm_len=0) at /data/src/10.4/sql/handler.cc:4786
      #17 0x000055ee1c90176a in mysql_change_partitions (lpt=0x7f4a9439b570) at /data/src/10.4/sql/sql_partition.cc:6072
      #18 0x000055ee1c904e92 in fast_alter_partition_table (thd=0x7f4a84000af0, table=0x7f4a840b34e0, alter_info=0x7f4a9439dc30, create_info=0x7f4a9439dcf0, table_list=0x7f4a840132c8, db=0x7f4a9439d110, table_name=0x7f4a9439d120) at /data/src/10.4/sql/sql_partition.cc:7437
      #19 0x000055ee1c4b5b02 in mysql_alter_table (thd=0x7f4a84000af0, new_db=0x7f4a840052b0, new_name=0x7f4a840056b8, create_info=0x7f4a9439dcf0, table_list=0x7f4a840132c8, alter_info=0x7f4a9439dc30, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9864
      #20 0x000055ee1c54e4dd in Sql_cmd_alter_table::execute (this=0x7f4a84013d00, thd=0x7f4a84000af0) at /data/src/10.4/sql/sql_alter.cc:508
      #21 0x000055ee1c3cce69 in mysql_execute_command (thd=0x7f4a84000af0) at /data/src/10.4/sql/sql_parse.cc:6102
      #22 0x000055ee1c3d252b in mysql_parse (thd=0x7f4a84000af0, rawbuf=0x7f4a84013198 "ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 HISTORY)", length=65, parser_state=0x7f4a9439f160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #23 0x000055ee1c3bd6d0 in dispatch_command (command=COM_QUERY, thd=0x7f4a84000af0, packet=0x7f4a840083a1 "ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 HISTORY)", packet_length=65, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #24 0x000055ee1c3bbd5d in do_command (thd=0x7f4a84000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #25 0x000055ee1c544ded in do_handle_one_connection (connect=0x55ee1e9b4d60) at /data/src/10.4/sql/sql_connect.cc:1412
      #26 0x000055ee1c544b3c in handle_one_connection (arg=0x55ee1e9b4d60) at /data/src/10.4/sql/sql_connect.cc:1316
      #27 0x000055ee1cf4b19f in pfs_spawn_thread (arg=0x55ee1e9462b0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #28 0x00007f4a9c1564a4 in start_thread (arg=0x7f4a943a0700) at pthread_create.c:456
      #29 0x00007f4a9a28ad0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.4, 10.5.
      The test case isn't applicable to 10.3 due to the long unique key.

        Attachments

          Activity

            People

            Assignee:
            midenok Aleksey Midenkov
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: