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

MySQL#86607 InnoDB crash after failed ADD INDEX and table_definition_cache eviction

    XMLWordPrintable

Details

    Description

      Re-filing the upstream bug on behalf of the original reporter Jianwei Zhao.

      Sleep injection

      diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
      index 41c767a..bfd7102 100644
      --- a/storage/innobase/handler/ha_innodb.cc
      +++ b/storage/innobase/handler/ha_innodb.cc
      @@ -6779,6 +6779,7 @@ no_commit:
       
       		build_template(true);
       	}
      +	os_thread_sleep(5000000);
       
       	innobase_srv_conc_enter_innodb(prebuilt->trx);
       
      diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
      index e772208..dea7696 100644
      --- a/storage/innobase/handler/handler0alter.cc
      +++ b/storage/innobase/handler/handler0alter.cc
      @@ -4138,6 +4138,7 @@ rollback_inplace_alter_table(
       		(almost) nothing has been or needs to be done. */
       		goto func_exit;
       	}
      +	os_thread_sleep(2000000);
       
       	row_mysql_lock_data_dictionary(ctx->trx);
      

      Test case

      --source include/have_innodb.inc
       
      connect(con1,localhost,root,,);
      connect(con2,localhost,root,,);
      let $MYSQLD_DATADIR= `SELECT @@datadir`;
       
      connection con1;
      set global table_definition_cache=400;
      set global table_open_cache= 1024;
       
      use test;
      create table t_bug(id int primary key, col1 int) engine=innodb;
      insert into t_bug values(1, 2);
      insert into t_bug values(2, 2);
      commit;
       
      ####
      #Sleep 2s to wait INSERT statement increment table->n_ref_count.
      ####
      --send
      alter table t_bug add unique key(col1);
       
      connection con2;
      use test;
      select * from t_bug;
       
      ####
      #Sleep 5s to wait ALTER statement complete.
      ####
      insert into t_bug values(3, 2);
      commit;
       
      ####
      #So ALTER statement failed, left table->drop_abort=true;
      ####
      connection con1;
      --error 1062
      --reap
       
      disconnect con2;
       
      connection con1;
      select sleep(10);
       
      ####
      #Flush tables, so t_bug table can be evicted by master thread.
      ####
      flush tables;
       
      ####
      #Create 1000 tables, try the best to evict t_bug since table_def_size.
      ####
      --disable_query_log
      let $loop=1000;
      while($loop)
      {
        eval create table t_$loop(id int)engine=innodb;
        dec $loop;
      }
       
      select sleep(10);
       
      let $loop=1000;
      while($loop)
      {
        eval drop table t_$loop;
        dec $loop;
      }
       
      --enable_query_log
      set global table_definition_cache=default;
      set global table_open_cache= default;
      drop table t_bug;
       
      --exec grep 't_bug' $MYSQLD_DATADIR/../../log/mysqld.1.err
       
      disconnect con1;
      

      10.0 449a88e1c629b without injection

      #2  0x0000000000836793 in handle_fatal_signal (sig=11) at /data/src/10.0/sql/signal_handler.cc:285
      #3  <signal handler called>
      #4  0x00007f1d9802485b in dict_index_is_clust (index=0x0) at /data/src/10.0/storage/innobase/include/dict0dict.ic:269
      #5  0x00007f1d9802e60c in row_merge_drop_indexes (trx=0x7f1d8fc4aa78, table=0x7f1d8b8300f8, locked=1) at /data/src/10.0/storage/innobase/row/row0merge.cc:2900
      #6  0x00007f1d97ec48e8 in dict_table_remove_from_cache_low (table=0x7f1d8b8300f8, lru_evict=1) at /data/src/10.0/storage/innobase/dict/dict0dict.cc:2146
      #7  0x00007f1d97ec2749 in dict_make_room_in_cache (max_tables=400, pct_check=50) at /data/src/10.0/storage/innobase/dict/dict0dict.cc:1485
      #8  0x00007f1d98088530 in srv_master_evict_from_table_cache (pct_check=50) at /data/src/10.0/storage/innobase/srv/srv0srv.cc:2078
      #9  0x00007f1d98088966 in srv_master_do_active_tasks () at /data/src/10.0/storage/innobase/srv/srv0srv.cc:2200
      #10 0x00007f1d980891e7 in srv_master_thread (arg=0x0) at /data/src/10.0/storage/innobase/srv/srv0srv.cc:2387
      #11 0x00007f1da13c3494 in start_thread (arg=0x7f1d917fd700) at pthread_create.c:333
      #12 0x00007f1d9f50e93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.1 112b21da37d without injection

      #3  <signal handler called>
      #4  0x00007f254a3ebceb in dict_index_is_clust (index=0x0) at /data/src/10.1-bug3/storage/innobase/include/dict0dict.ic:270
      #5  0x00007f254a3f6976 in row_merge_drop_indexes (trx=0x7f2550493278, table=0x7f25496e78f8, locked=1) at /data/src/10.1-bug3/storage/innobase/row/row0merge.cc:3184
      #6  0x00007f254a2615a9 in dict_table_remove_from_cache_low (table=0x7f25496e78f8, lru_evict=1) at /data/src/10.1-bug3/storage/innobase/dict/dict0dict.cc:2170
      #7  0x00007f254a25f305 in dict_make_room_in_cache (max_tables=400, pct_check=50) at /data/src/10.1-bug3/storage/innobase/dict/dict0dict.cc:1509
      #12 0x00007f2550d7193f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.2 2d8fdfbde5d5d32 without injection

      #2  0x000055a81a2abd1e in handle_fatal_signal (sig=11) at /data/src/10.2/sql/signal_handler.cc:299
      #3  <signal handler called>
      #4  0x000055a81a6e4b89 in dict_index_is_clust (index=0x0) at /data/src/10.2/storage/innobase/include/dict0dict.ic:298
      #5  0x000055a81a6f25bc in row_merge_drop_indexes (trx=0x7efdd4e17cc0, table=0x7efd7802de08, locked=1) at /data/src/10.2/storage/innobase/row/row0merge.cc:3801
      #6  0x000055a81a87f34e in dict_table_remove_from_cache_low (table=0x7efd7802de08, lru_evict=1) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:2119
      #7  0x000055a81a87d151 in dict_make_room_in_cache (max_tables=400, pct_check=100) at /data/src/10.2/storage/innobase/dict/dict0dict.cc:1490
      #8  0x000055a81a76d09e in srv_master_evict_from_table_cache (pct_check=100) at /data/src/10.2/storage/innobase/srv/srv0srv.cc:2159
      #9  0x000055a81a76db2c in srv_master_do_idle_tasks () at /data/src/10.2/storage/innobase/srv/srv0srv.cc:2398
      #10 0x000055a81a76e0ca in srv_master_thread (arg=0x0) at /data/src/10.2/storage/innobase/srv/srv0srv.cc:2523
      #11 0x00007efddcdd6494 in start_thread (arg=0x7efdc27fc700) at pthread_create.c:333
      #12 0x00007efddaf4e93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.1 112b21da37d with injection

      #2  0x000055ba7b38b34a in handle_fatal_signal (sig=11) at /data/src/10.1-bug3/sql/signal_handler.cc:296
      #3  <signal handler called>
      #4  0x00007feb84febcff in dict_index_is_clust (index=0x0) at /data/src/10.1-bug3/storage/innobase/include/dict0dict.ic:270
      #5  0x00007feb84ff698a in row_merge_drop_indexes (trx=0x7feb8b093278, table=0x7feb842e78f8, locked=1) at /data/src/10.1-bug3/storage/innobase/row/row0merge.cc:3184
      #6  0x00007feb84e615a9 in dict_table_remove_from_cache_low (table=0x7feb842e78f8, lru_evict=1) at /data/src/10.1-bug3/storage/innobase/dict/dict0dict.cc:2170
      #7  0x00007feb84e5f305 in dict_make_room_in_cache (max_tables=400, pct_check=50) at /data/src/10.1-bug3/storage/innobase/dict/dict0dict.cc:1509
      #8  0x00007feb85054c7c in srv_master_evict_from_table_cache (pct_check=50) at /data/src/10.1-bug3/storage/innobase/srv/srv0srv.cc:2176
      #9  0x00007feb850550ba in srv_master_do_active_tasks () at /data/src/10.1-bug3/storage/innobase/srv/srv0srv.cc:2299
      #10 0x00007feb85055a95 in srv_master_thread (arg=0x0) at /data/src/10.1-bug3/storage/innobase/srv/srv0srv.cc:2491
      #11 0x00007feb8db21494 in start_thread (arg=0x7feb7c7fd700) at pthread_create.c:333
      #12 0x00007feb8bc6c93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              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.