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

Server crashes in in myrocks::ha_rocksdb::load_auto_incr_value_from_index upon altering AUTO_INCREMENT on a table without index

Details

    Description

      # Run with RocksDB
       
      CREATE OR REPLACE TABLE t1 (a INT) ENGINE=RocksDB;
      INSERT INTO t1 VALUES (1);
      ALTER TABLE t1 AUTO_INCREMENT 10;
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 6c0f3dd34

      #3  <signal handler called>
      #4  0x00007f3d0d2c9ae4 in myrocks::ha_rocksdb::load_auto_incr_value_from_index (this=0x7f3cdc0098f8) at /data/src/10.2/storage/rocksdb/ha_rocksdb.cc:5152
      #5  0x00007f3d0d2df34c in myrocks::ha_rocksdb::prepare_inplace_alter_table (this=0x7f3cdc0098f8, altered_table=0x7f3cdc0b3ce0, ha_alter_info=0x7f3d04dd6610) at /data/src/10.2/storage/rocksdb/ha_rocksdb.cc:11737
      #6  0x0000557afc412083 in handler::ha_prepare_inplace_alter_table (this=0x7f3cdc0098f8, altered_table=0x7f3cdc0b3ce0, ha_alter_info=0x7f3d04dd6610) at /data/src/10.2/sql/handler.cc:4210
      #7  0x0000557afc264e01 in mysql_inplace_alter_table (thd=0x7f3cdc000b00, table_list=0x7f3cdc012538, table=0x7f3cdc0c6b10, altered_table=0x7f3cdc0b3ce0, ha_alter_info=0x7f3d04dd6610, inplace_supported=HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE, target_mdl_request=0x7f3d04dd6680, alter_ctx=0x7f3d04dd7240) at /data/src/10.2/sql/sql_table.cc:7301
      #8  0x0000557afc26a5ca in mysql_alter_table (thd=0x7f3cdc000b00, new_db=0x7f3cdc012b48 "test", new_name=0x0, create_info=0x7f3d04dd7e50, table_list=0x7f3cdc012538, alter_info=0x7f3d04dd7da0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9355
      #9  0x0000557afc2e4346 in Sql_cmd_alter_table::execute (this=0x7f3cdc012b58, thd=0x7f3cdc000b00) at /data/src/10.2/sql/sql_alter.cc:324
      #10 0x0000557afc19eedc in mysql_execute_command (thd=0x7f3cdc000b00) at /data/src/10.2/sql/sql_parse.cc:6224
      #11 0x0000557afc1a3a48 in mysql_parse (thd=0x7f3cdc000b00, rawbuf=0x7f3cdc012448 "ALTER TABLE t1 AUTO_INCREMENT 10", length=32, parser_state=0x7f3d04dd9200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7940
      #12 0x0000557afc191739 in dispatch_command (command=COM_QUERY, thd=0x7f3cdc000b00, packet=0x7f3cdc18baf1 "ALTER TABLE t1 AUTO_INCREMENT 10", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1820
      #13 0x0000557afc19009c in do_command (thd=0x7f3cdc000b00) at /data/src/10.2/sql/sql_parse.cc:1374
      #14 0x0000557afc2df038 in do_handle_one_connection (connect=0x557aff461290) at /data/src/10.2/sql/sql_connect.cc:1335
      #15 0x0000557afc2dedc5 in handle_one_connection (arg=0x557aff461290) at /data/src/10.2/sql/sql_connect.cc:1241
      #16 0x0000557afc6fffa0 in pfs_spawn_thread (arg=0x557aff46b800) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #17 0x00007f3d143e1494 in start_thread (arg=0x7f3d04dda700) at pthread_create.c:333
      #18 0x00007f3d127c793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      It is a recent regression, apparently from the last merge or post-merge changes, I didn't search for the exact commit.

      Attachments

        Activity

          We crash here:

              Field *field =
                  table->key_info[table->s->next_number_index].key_part[0].field;
          

          and we crash because

          (gdb) p table->key_info[0]
            Cannot access memory at address 0x0
          

          and this "makes sense" because the table doesn't have any indexes.

          psergei Sergei Petrunia added a comment - We crash here: Field *field = table->key_info[table->s->next_number_index].key_part[0].field; and we crash because (gdb) p table->key_info[0] Cannot access memory at address 0x0 and this "makes sense" because the table doesn't have any indexes.

          The upstream that I have merged from crashes as well:

          #0  __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
          #1  0x000000000135ee00 in my_write_core (sig=11) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/mysys/stacktrace.c:469
          #2  0x0000000000f2a8eb in handle_fatal_signal (sig=11) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/signal_handler.cc:239
          #3  <signal handler called>
          #4  0x00000000016a2224 in myrocks::ha_rocksdb::load_auto_incr_value_from_index (this=0x7f8784057330) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/storage/rocksdb/ha_rocksdb.cc:4773
          #5  0x00000000016b7e81 in myrocks::ha_rocksdb::prepare_inplace_alter_table (this=0x7f8784057330, altered_table=0x7f8784090540, ha_alter_info=0x7f8795672a50) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/storage/rocksdb/ha_rocksdb.cc:11187
          #6  0x0000000000df1839 in handler::ha_prepare_inplace_alter_table (this=0x7f8784057330, altered_table=0x7f8784090540, ha_alter_info=0x7f8795672a50) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/handler.cc:4721
          #7  0x00000000010780c7 in mysql_inplace_alter_table (thd=0x32eff60, table_list=0x7f8784005728, table=0x7f878405dd90, altered_table=0x7f8784090540, ha_alter_info=0x7f8795672a50, inplace_supported=HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE, target_mdl_request=0x7f8795672ac0, alter_ctx=0x7f87956731e0) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_table.cc:6779
          #8  0x000000000107d905 in mysql_alter_table (thd=0x32eff60, new_db=0x7f8784005c90 "test", new_name=0x0, create_info=0x7f8795674250, table_list=0x7f8784005728, alter_info=0x7f8795674170, order_num=0, order=0x0, ignore=false) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_table.cc:8957
          #9  0x00000000012011a2 in Sql_cmd_alter_table::execute (this=0x7f8784005ca0, thd=0x32eff60) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_alter.cc:335
          #10 0x0000000000ff56ba in mysql_execute_command (thd=0x32eff60, statement_start_time=0x7f8795675a48, post_parse=0x7f8795675c00) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_parse.cc:6143
          #11 0x0000000000ff9827 in mysql_parse (thd=0x32eff60, rawbuf=0x7f8784005630 "ALTER TABLE t1 AUTO_INCREMENT 10", length=32, parser_state=0x7f87956764b0, last_timer=0x7f8795675c00, async_commit=0x7f8795675b6b "") at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_parse.cc:7829
          #12 0x0000000000fe9d61 in dispatch_command (command=COM_QUERY, thd=0x32eff60, packet=0x32fff81 "ALTER TABLE t1 AUTO_INCREMENT 10", packet_length=32, srv_session=0x0) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_parse.cc:1897
          

          psergei Sergei Petrunia added a comment - The upstream that I have merged from crashes as well: #0 __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62 #1 0x000000000135ee00 in my_write_core (sig=11) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/mysys/stacktrace.c:469 #2 0x0000000000f2a8eb in handle_fatal_signal (sig=11) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/signal_handler.cc:239 #3 <signal handler called> #4 0x00000000016a2224 in myrocks::ha_rocksdb::load_auto_incr_value_from_index (this=0x7f8784057330) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/storage/rocksdb/ha_rocksdb.cc:4773 #5 0x00000000016b7e81 in myrocks::ha_rocksdb::prepare_inplace_alter_table (this=0x7f8784057330, altered_table=0x7f8784090540, ha_alter_info=0x7f8795672a50) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/storage/rocksdb/ha_rocksdb.cc:11187 #6 0x0000000000df1839 in handler::ha_prepare_inplace_alter_table (this=0x7f8784057330, altered_table=0x7f8784090540, ha_alter_info=0x7f8795672a50) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/handler.cc:4721 #7 0x00000000010780c7 in mysql_inplace_alter_table (thd=0x32eff60, table_list=0x7f8784005728, table=0x7f878405dd90, altered_table=0x7f8784090540, ha_alter_info=0x7f8795672a50, inplace_supported=HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE, target_mdl_request=0x7f8795672ac0, alter_ctx=0x7f87956731e0) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_table.cc:6779 #8 0x000000000107d905 in mysql_alter_table (thd=0x32eff60, new_db=0x7f8784005c90 "test", new_name=0x0, create_info=0x7f8795674250, table_list=0x7f8784005728, alter_info=0x7f8795674170, order_num=0, order=0x0, ignore=false) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_table.cc:8957 #9 0x00000000012011a2 in Sql_cmd_alter_table::execute (this=0x7f8784005ca0, thd=0x32eff60) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_alter.cc:335 #10 0x0000000000ff56ba in mysql_execute_command (thd=0x32eff60, statement_start_time=0x7f8795675a48, post_parse=0x7f8795675c00) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_parse.cc:6143 #11 0x0000000000ff9827 in mysql_parse (thd=0x32eff60, rawbuf=0x7f8784005630 "ALTER TABLE t1 AUTO_INCREMENT 10", length=32, parser_state=0x7f87956764b0, last_timer=0x7f8795675c00, async_commit=0x7f8795675b6b "") at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_parse.cc:7829 #12 0x0000000000fe9d61 in dispatch_command (command=COM_QUERY, thd=0x32eff60, packet=0x32fff81 "ALTER TABLE t1 AUTO_INCREMENT 10", packet_length=32, srv_session=0x0) at /home/psergey/dev-git/mysql-5.6-rocksdb-mergefrom/sql/sql_parse.cc:1897

          Doesn't crash with the latest upstream, though

          psergei Sergei Petrunia added a comment - Doesn't crash with the latest upstream, though
          psergei Sergei Petrunia added a comment - Seems to be fixed by this one https://github.com/facebook/mysql-5.6/commit/997a979bf5e2f75ab88781d9d3fd22dddc1fc21f

          People

            psergei Sergei Petrunia
            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.