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

Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION

    XMLWordPrintable

Details

    Description

      Note: results and stack traces vary between versions, but all 10.x are affected, including 10.0.10. 5.5 seems to be okay, MySQL 5.6 too. Please note that the comment seems important for the result, so if you are trying to reproduce from the command-line client, make sure that comments are not stripped before the queries are sent to the server (run the client with -c).

      Test case with comment

      --source include/have_partition.inc
       
      CREATE TABLE t1 (i INT) PARTITION BY RANGE(i) (PARTITION p0 VALUES LESS THAN (10));
      LOCK TABLE t1 WRITE;
      --error ER_SAME_NAME_PARTITION
      ALTER TABLE t1 ADD PARTITION (PARTITION p0 VALUES LESS THAN (20));
      ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20)) /* COMMENT */;
       
      # Cleanup
      DROP TABLE t1;
      

      10.0 b728641e862df

      #3  <signal handler called>
      #4  0x00007fe34ce73496 in strlen () from /lib/x86_64-linux-gnu/libc.so.6
      #5  0x000000000074bd4f in get_part_name_from_elem (name=0x0, length=0x7fe34eeeb778, not_used=1 '\001') at /data/src/10.0/sql/partition_info.cc:951
      #6  0x0000000000e0109e in my_hash_key (hash=0x7fe34eeeb870, record=0x0, length=0x7fe34eeeb778, first=1 '\001') at /data/src/10.0/mysys/hash.c:190
      #7  0x0000000000e015c7 in my_hash_insert (info=0x7fe34eeeb870, record=0x0) at /data/src/10.0/mysys/hash.c:394
      #8  0x000000000074be8a in partition_info::find_duplicate_name (this=0x7fe34578ee88) at /data/src/10.0/sql/partition_info.cc:1000
      #9  0x000000000074d9e5 in partition_info::check_partition_info (this=0x7fe34578ee88, thd=0x7fe346ea2070, eng_type=0x0, file=0x7fe34547e088, info=0x0, add_or_reorg_part=true) at /data/src/10.0/sql/partition_info.cc:1759
      #10 0x00000000009ac84f in prep_alter_part_table (thd=0x7fe346ea2070, table=0x7fe34549e470, alter_info=0x7fe34eeed450, create_info=0x7fe34eeed4e0, alter_ctx=0x7fe34eeec840, partition_changed=0x7fe34eeed33b, fast_alter_table=0x7fe34eeed33a) at /data/src/10.0/sql/sql_partition.cc:5524
      #11 0x0000000000704c9f in mysql_alter_table (thd=0x7fe346ea2070, new_db=0x7fe3454fa7b0 "test", new_name=0x0, create_info=0x7fe34eeed4e0, table_list=0x7fe3454fa1d0, alter_info=0x7fe34eeed450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8606
      #12 0x000000000076e2cd in Sql_cmd_alter_table::execute (this=0x7fe3454faf88, thd=0x7fe346ea2070) at /data/src/10.0/sql/sql_alter.cc:312
      #13 0x0000000000654607 in mysql_execute_command (thd=0x7fe346ea2070) at /data/src/10.0/sql/sql_parse.cc:5114
      #14 0x0000000000657a3e in mysql_parse (thd=0x7fe346ea2070, rawbuf=0x7fe3454fa088 "ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20)) /* COMMENT */", length=79, parser_state=0x7fe34eeee640) at /data/src/10.0/sql/sql_parse.cc:6569
      #15 0x000000000064a57d in dispatch_command (command=COM_QUERY, thd=0x7fe346ea2070, packet=0x7fe3483e5071 "ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20)) /* COMMENT */", packet_length=79) at /data/src/10.0/sql/sql_parse.cc:1296
      #16 0x000000000064987d in do_command (thd=0x7fe346ea2070) at /data/src/10.0/sql/sql_parse.cc:999
      #17 0x0000000000769a20 in do_handle_one_connection (thd_arg=0x7fe346ea2070) at /data/src/10.0/sql/sql_connect.cc:1377
      #18 0x0000000000769792 in handle_one_connection (arg=0x7fe346ea2070) at /data/src/10.0/sql/sql_connect.cc:1292
      #19 0x0000000000aca18c in pfs_spawn_thread (arg=0x7fe346da2370) at /data/src/10.0/storage/perfschema/pfs.cc:1861
      #20 0x00007fe34eb22494 in start_thread (arg=0x7fe34eeef700) at pthread_create.c:333
      #21 0x00007fe34cedb93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Similar stack traces on 10.1, 10.2.

      10.3 d70573564cb2

      #3  <signal handler called>
      #4  0x0000564df27ca621 in check_mysql50_prefix (name=0x0) at /data/src/10.3/sql/sql_table.cc:420
      #5  0x0000564df27ca672 in check_n_cut_mysql50_prefix (from=0x0, to=0x7f1b444ebe50 "p0", to_length=512) at /data/src/10.3/sql/sql_table.cc:441
      #6  0x0000564df27ca779 in tablename_to_filename (from=0x0, to=0x7f1b444ebe50 "p0", to_length=512) at /data/src/10.3/sql/sql_table.cc:474
      #7  0x0000564df3167799 in ha_partition::create_handler_file (this=0x7f1b340757a8, name=0x7f1b444ec9b0 "./test/#sql-t1") at /data/src/10.3/sql/ha_partition.cc:2677
      #8  0x0000564df3161d57 in ha_partition::create_partitioning_metadata (this=0x7f1b340757a8, path=0x7f1b444ec9b0 "./test/#sql-t1", old_path=0x0, action_flag=0) at /data/src/10.3/sql/ha_partition.cc:661
      #9  0x0000564df29f7b9e in handler::ha_create_partitioning_metadata (this=0x7f1b340757a8, name=0x7f1b444ec9b0 "./test/#sql-t1", old_name=0x0, action_flag=0) at /data/src/10.3/sql/handler.cc:4575
      #10 0x0000564df27cdc4c in mysql_write_frm (lpt=0x7f1b444ed070, flags=1) at /data/src/10.3/sql/sql_table.cc:1873
      #11 0x0000564df2babf6d in fast_alter_partition_table (thd=0x7f1b34000b00, table=0x7f1b34074b60, alter_info=0x7f1b444eebb0, create_info=0x7f1b444eec60, table_list=0x7f1b34014e90, db=0x7f1b444ee090, table_name=0x7f1b444ee0a0) at /data/src/10.3/sql/sql_partition.cc:7255
      #12 0x0000564df27e36f0 in mysql_alter_table (thd=0x7f1b34000b00, new_db=0x7f1b34005148, new_name=0x7f1b340054f8, create_info=0x7f1b444eec60, table_list=0x7f1b34014e90, alter_info=0x7f1b444eebb0, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:9556
      #13 0x0000564df28696eb in Sql_cmd_alter_table::execute (this=0x7f1b34015cb0, thd=0x7f1b34000b00) at /data/src/10.3/sql/sql_alter.cc:334
      #14 0x0000564df270ef8b in mysql_execute_command (thd=0x7f1b34000b00) at /data/src/10.3/sql/sql_parse.cc:6280
      #15 0x0000564df2713b4c in mysql_parse (thd=0x7f1b34000b00, rawbuf=0x7f1b34014d48 "ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20)) /* COMMENT */", length=79, parser_state=0x7f1b444f05d0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8009
      #16 0x0000564df2701200 in dispatch_command (command=COM_QUERY, thd=0x7f1b34000b00, packet=0x7f1b3408ffc1 "ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20)) /* COMMENT */", packet_length=79, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1838
      #17 0x0000564df26ffc3f in do_command (thd=0x7f1b34000b00) at /data/src/10.3/sql/sql_parse.cc:1383
      #18 0x0000564df28640fd in do_handle_one_connection (connect=0x564df5b6abe0) at /data/src/10.3/sql/sql_connect.cc:1402
      #19 0x0000564df2863e8a in handle_one_connection (arg=0x564df5b6abe0) at /data/src/10.3/sql/sql_connect.cc:1308
      #20 0x0000564df2cf1f11 in pfs_spawn_thread (arg=0x564df5b7e480) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #21 0x00007f1b4c020494 in start_thread (arg=0x7f1b444f1700) at pthread_create.c:333
      #22 0x00007f1b4a40693f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.0 - 10.2 also produce an unexpected error upon the second ALTER even without the comment:

      Test case without comment

      --source include/have_partition.inc
       
      CREATE TABLE t1 (i INT) PARTITION BY RANGE(i) (PARTITION p0 VALUES LESS THAN (10));
      LOCK TABLE t1 WRITE;
      --error ER_SAME_NAME_PARTITION
      ALTER TABLE t1 ADD PARTITION (PARTITION p0 VALUES LESS THAN (20));
      ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20));
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 b728641e862

      CREATE TABLE t1 (i INT) PARTITION BY RANGE(i) (PARTITION p0 VALUES LESS THAN (10));
      LOCK TABLE t1 WRITE;
      ALTER TABLE t1 ADD PARTITION (PARTITION p0 VALUES LESS THAN (20));
      ERROR HY000: Duplicate partition name p0
      ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20));
      bug.vers2a                               [ fail ]
              Test ended at 2018-03-03 18:59:50
       
      CURRENT_TEST: bug.vers2a
      mysqltest: At line 7: query 'ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20))' failed: 1517: Duplicate partition name p1
      


      --source include/have_partition.inc
       
      CREATE TABLE t1 (i INT) PARTITION BY RANGE(i) (PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (15));
      LOCK TABLE t1 WRITE;
      --error ER_SAME_NAME_PARTITION
      ALTER TABLE t1 ADD PARTITION (PARTITION p0 VALUES LESS THAN (20));
      ALTER TABLE t1 DROP PARTITION p1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.0 debug 400a8eb60f83

      #3  <signal handler called>
      #4  0x00000000009ac3b1 in prep_alter_part_table (thd=0x7f295d6a8070, table=0x7f295b89e470, alter_info=0x7f296568c450, create_info=0x7f296568c4e0, alter_ctx=0x7f296568b840, partition_changed=0x7f296568c33b, fast_alter_table=0x7f296568c33a) at /data/src/10.0/sql/sql_partition.cc:5202
      #5  0x0000000000705093 in mysql_alter_table (thd=0x7f295d6a8070, new_db=0x7f295b8fa758 "test", new_name=0x0, create_info=0x7f296568c4e0, table_list=0x7f295b8fa178, alter_info=0x7f296568c450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8606
      #6  0x000000000076e6d1 in Sql_cmd_alter_table::execute (this=0x7f295b8fa778, thd=0x7f295d6a8070) at /data/src/10.0/sql/sql_alter.cc:312
      #7  0x00000000006548df in mysql_execute_command (thd=0x7f295d6a8070) at /data/src/10.0/sql/sql_parse.cc:5114
      #8  0x0000000000657d16 in mysql_parse (thd=0x7f295d6a8070, rawbuf=0x7f295b8fa088 "ALTER TABLE t1 DROP PARTITION p1", length=32, parser_state=0x7f296568d640) at /data/src/10.0/sql/sql_parse.cc:6569
      #9  0x000000000064a855 in dispatch_command (command=COM_QUERY, thd=0x7f295d6a8070, packet=0x7f295ebe5071 "ALTER TABLE t1 DROP PARTITION p1", packet_length=32) at /data/src/10.0/sql/sql_parse.cc:1296
      #10 0x0000000000649b55 in do_command (thd=0x7f295d6a8070) at /data/src/10.0/sql/sql_parse.cc:999
      #11 0x0000000000769e24 in do_handle_one_connection (thd_arg=0x7f295d6a8070) at /data/src/10.0/sql/sql_connect.cc:1377
      #12 0x0000000000769b96 in handle_one_connection (arg=0x7f295d6a8070) at /data/src/10.0/sql/sql_connect.cc:1292
      #13 0x0000000000aca772 in pfs_spawn_thread (arg=0x7f295d5a25f0) at /data/src/10.0/storage/perfschema/pfs.cc:1861
      #14 0x00007f296530a494 in start_thread (arg=0x7f296568e700) at pthread_create.c:333
      #15 0x00007f29636c393f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.0 non-debug 400a8eb60f83

      #2  <signal handler called>
      #3  intern_plugin_unlock (lex=lex@entry=0x0, plugin=0x7000090000000000) at /data/src/10.0/sql/sql_plugin.cc:1282
      #4  0x00000000005b14d0 in plugin_unlock_list (thd=thd@entry=0x0, list=0x7efd5b5aa600, count=<optimized out>) at /data/src/10.0/sql/sql_plugin.cc:1346
      #5  0x0000000000a7d9ed in ha_partition::clear_handler_file (this=this@entry=0x7efd5b450720) at /data/src/10.0/sql/ha_partition.cc:2801
      #6  0x0000000000a7ddb2 in ha_partition::setup_engine_array (this=this@entry=0x7efd5b450720, mem_root=mem_root@entry=0x7efd5b420790) at /data/src/10.0/sql/ha_partition.cc:3065
      #7  0x0000000000a7de41 in ha_partition::get_from_handler_file (this=0x7efd5b450720, name=<optimized out>, mem_root=0x7efd5b420790, is_clone=<optimized out>) at /data/src/10.0/sql/ha_partition.cc:3119
      #8  0x0000000000a7e4f2 in ha_partition::initialize_partition (this=0x7efd5b450720, mem_root=<optimized out>) at /data/src/10.0/sql/ha_partition.cc:490
      #9  0x0000000000a803a1 in partition_create_handler (hton=0x7efd6284b208, share=0x7efd5b420720, mem_root=0x7efd5b420790) at /data/src/10.0/sql/ha_partition.cc:195
      #10 0x00000000006e30c8 in get_new_handler (share=0x7efd5b420720, alloc=0x7efd5b420790, db_type=<optimized out>) at /data/src/10.0/sql/handler.cc:254
      #11 0x0000000000636e2a in TABLE_SHARE::init_from_binary_frm_image (this=0x7efd5b420720, thd=0x7000090000000000, thd@entry=0x7efd5d05f008, write=24, write@entry=false, frm_image=0x0, frm_image@entry=0x7efd5b5aa808 "\376\001\t\024\032", frm_length=18446744073709551615) at /data/src/10.0/sql/table.cc:1407
      #12 0x0000000000638db1 in open_table_def (thd=thd@entry=0x7efd5d05f008, share=share@entry=0x7efd5b420720, flags=flags@entry=11) at /data/src/10.0/sql/table.cc:633
      #13 0x000000000069c023 in tdc_acquire_share (thd=0x7efd5d05f008, db=0x7efd5b406600 "test", table_name=0x7efd5b406608 "t1", key=<optimized out>, key_length=8, hash_value=<optimized out>, flags=3, out_table=0x7efd653efb88) at /data/src/10.0/sql/table_cache.cc:741
      #14 0x000000000056fab3 in open_table (thd=0x7efd5d05f008, table_list=0x7efd5b406020, mem_root=0x7efd5f141c18, ot_ctx=0x7efd653f0150) at /data/src/10.0/sql/sql_base.cc:2373
      #15 0x00000000005703d7 in Locked_tables_list::reopen_tables (this=this@entry=0x7efd5d0626e0, thd=thd@entry=0x7efd5d05f008) at /data/src/10.0/sql/sql_base.cc:2991
      #16 0x0000000000513b55 in alter_partition_lock_handling (lpt=lpt@entry=0x7efd653f0520) at /data/src/10.0/sql/sql_partition.cc:6561
      #17 0x00000000007e2566 in fast_alter_partition_table (thd=0x7efd5d05f008, table=<optimized out>, alter_info=<optimized out>, create_info=<optimized out>, table_list=0x7efd5b62d110, db=<optimized out>, table_name=0x7efd5b62d0d8 "t1") at /data/src/10.0/sql/sql_partition.cc:7171
      #18 0x0000000000620ee4 in mysql_alter_table (thd=0x7efd5d05f008, new_db=0x7000090000000000 <error: Cannot access memory at address 0x7000090000000000>, new_name=0x0, create_info=0x7efd653f2280, table_list=0x7efd5b62d110, alter_info=0x7efd653f21f0, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8662
      #19 0x000000000065fc3d in Sql_cmd_alter_table::execute (this=0x0, thd=0x7efd5d05f008) at /data/src/10.0/sql/sql_alter.cc:312
      #20 0x00000000005a4b12 in mysql_execute_command (thd=0x7efd5d05f008) at /data/src/10.0/sql/sql_parse.cc:5114
      #21 0x00000000005abab8 in mysql_parse (thd=0x7efd5d05f008, rawbuf=<optimized out>, length=32, parser_state=0x7efd653f3850) at /data/src/10.0/sql/sql_parse.cc:6569
      #22 0x00000000005ad566 in dispatch_command (command=<optimized out>, thd=0x7efd5d05f008, packet=<optimized out>, packet_length=<optimized out>) at /data/src/10.0/sql/sql_parse.cc:1296
      #23 0x00000000005adf1f in do_command (thd=<optimized out>) at /data/src/10.0/sql/sql_parse.cc:999
      #24 0x000000000065d384 in do_handle_one_connection (thd_arg=thd_arg@entry=0x7efd5d05f008) at /data/src/10.0/sql/sql_connect.cc:1377
      #25 0x000000000065d3c8 in handle_one_connection (arg=arg@entry=0x7efd5d05f008) at /data/src/10.0/sql/sql_connect.cc:1292
      #26 0x0000000000891a34 in pfs_spawn_thread (arg=0x7efd6283f808) at /data/src/10.0/storage/perfschema/pfs.cc:1861
      #27 0x00007efd65070494 in start_thread (arg=0x7efd653f4700) at pthread_create.c:333
      #28 0x00007efd6342993f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.3 non-debug 209375fdd07d

      mysqltest: At line 7: query 'ALTER TABLE t1 DROP PARTITION p1' failed: 1696: Failed to read from the .par file
      

      10.3 debug 0c8d6fd66c

      #3  <signal handler called>
      #4  0x0000563eaaecca66 in ha_partition::create_handler_file (this=0x7fd96c0768b8, name=0x7fd97f458990 "./test/#sql-t1") at /data/src/10.3/sql/ha_partition.cc:2672
      #5  0x0000563eaaec707b in ha_partition::create_partitioning_metadata (this=0x7fd96c0768b8, path=0x7fd97f458990 "./test/#sql-t1", old_path=0x0, action_flag=0) at /data/src/10.3/sql/ha_partition.cc:661
      #6  0x0000563eaa771656 in handler::ha_create_partitioning_metadata (this=0x7fd96c0768b8, name=0x7fd97f458990 "./test/#sql-t1", old_name=0x0, action_flag=0) at /data/src/10.3/sql/handler.cc:4584
      #7  0x0000563eaa547f16 in mysql_write_frm (lpt=0x7fd97f459050, flags=1) at /data/src/10.3/sql/sql_table.cc:1873
      #8  0x0000563eaa91f394 in fast_alter_partition_table (thd=0x7fd96c000b00, table=0x7fd96c075c70, alter_info=0x7fd97f45ab90, create_info=0x7fd97f45ac50, table_list=0x7fd96c014e48, db=0x7fd97f45a070, table_name=0x7fd97f45a080) at /data/src/10.3/sql/sql_partition.cc:7181
      #9  0x0000563eaa55d767 in mysql_alter_table (thd=0x7fd96c000b00, new_db=0x7fd96c005158, new_name=0x7fd96c005508, create_info=0x7fd97f45ac50, table_list=0x7fd96c014e48, alter_info=0x7fd97f45ab90, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:9522
      #10 0x0000563eaa5e3850 in Sql_cmd_alter_table::execute (this=0x7fd96c0154b8, thd=0x7fd96c000b00) at /data/src/10.3/sql/sql_alter.cc:334
      #11 0x0000563eaa488cb3 in mysql_execute_command (thd=0x7fd96c000b00) at /data/src/10.3/sql/sql_parse.cc:6284
      #12 0x0000563eaa48d886 in mysql_parse (thd=0x7fd96c000b00, rawbuf=0x7fd96c014d58 "ALTER TABLE t1 DROP PARTITION p1", length=32, parser_state=0x7fd97f45c5d0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8013
      #13 0x0000563eaa47af39 in dispatch_command (command=COM_QUERY, thd=0x7fd96c000b00, packet=0x7fd96c08fe31 "ALTER TABLE t1 DROP PARTITION p1", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1842
      #14 0x0000563eaa479978 in do_command (thd=0x7fd96c000b00) at /data/src/10.3/sql/sql_parse.cc:1387
      #15 0x0000563eaa5de243 in do_handle_one_connection (connect=0x563eadb8c420) at /data/src/10.3/sql/sql_connect.cc:1402
      #16 0x0000563eaa5ddfd0 in handle_one_connection (arg=0x563eadb8c420) at /data/src/10.3/sql/sql_connect.cc:1308
      #17 0x0000563eaaa656d3 in pfs_spawn_thread (arg=0x563eadc5e4f0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #18 0x00007fd98afef494 in start_thread (arg=0x7fd97f45d700) at pthread_create.c:333
      #19 0x00007fd9893d593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.