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

Server aborts while altering an InnoDB statistics table

    XMLWordPrintable

Details

    Description

      Note: I'm not sure the scenarios are limited to those touching stat tables explicitly, but that's the first one that I got as a test case.

      The test case is non-deterministic, run with --repeat=N. It currently fails for me within a few attempts, usually on the first one. The test case is rr-able.

      --source include/have_innodb.inc
       
      CREATE TABLE t (f INT) ENGINE=InnoDB;
      ANALYZE TABLE t;
       
      --connect (con1,localhost,root,,)
      --send
      	OPTIMIZE TABLE mysql.innodb_table_stats, mysql.innodb_index_stats;
       
      --connection default
      ALTER TABLE t ADD KEY idx(f);
      DROP TABLE t;
       
      # Cleanup
      --disconnect con1
      

      On debug builds of the current branches, it fails on the assertion; it can happen either on ALTER or on DROP. On non-debug builds and on older code, it hangs.

      Stack traces from the hanging server:

      11.3.1

      Thread 13 (Thread 0x7f3298dec6c0 (LWP 616449) "mariadbd"):
      #0  __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x7f3298de3c90, op=393, expected=0, futex_word=0x62c000220448) at ./nptl/futex-internal.c:57
      #1  __futex_abstimed_wait_common (futex_word=futex_word@entry=0x62c000220448, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x7f3298de3c90, private=private@entry=0, cancel=cancel@entry=true) at ./nptl/futex-internal.c:87
      #2  0x00007f32a6aa4e0b in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x62c000220448, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x7f3298de3c90, private=private@entry=0) at ./nptl/futex-internal.c:139
      #3  0x00007f32a6aa774c in __pthread_cond_wait_common (abstime=0x7f3298de3c90, clockid=0, mutex=0x62c000220398, cond=0x62c000220420) at ./nptl/pthread_cond_wait.c:503
      #4  ___pthread_cond_timedwait64 (cond=0x62c000220420, mutex=0x62c000220398, abstime=0x7f3298de3c90) at ./nptl/pthread_cond_wait.c:643
      #5  0x00005579fd42ac45 in safe_cond_timedwait (cond=0x62c000220420, mp=0x62c000220370, abstime=0x7f3298de3c90, file=0x5579fe6d1b20 "/data/bld/11.3.1-asan/mysys/my_thr_init.c", line=609) at /data/bld/11.3.1-asan/mysys/thr_mutex.c:548
      #6  0x00005579fd418890 in psi_cond_timedwait (that=0x62c000220420, mutex=0x62c000220370, abstime=0x7f3298de3c90, file=0x5579fd9c79c0 "/data/bld/11.3.1-asan/sql/mdl.cc", line=1214) at /data/bld/11.3.1-asan/mysys/my_thr_init.c:609
      #7  0x00005579fbc01f11 in inline_mysql_cond_timedwait (that=0x62c000220420, mutex=0x62c000220370, abstime=0x7f3298de3c90, src_file=0x5579fd9c79c0 "/data/bld/11.3.1-asan/sql/mdl.cc", src_line=1214) at /data/bld/11.3.1-asan/include/mysql/psi/mysql_thread.h:1086
      #8  0x00005579fbc04b86 in MDL_wait::timed_wait (this=0x62c000220370, owner=0x62c000220300, abs_timeout=0x7f3298de3c90, set_status_on_timeout=false, wait_state_name=0x5579ff0ccb50 <MDL_key::m_namespace_to_wait_state_name+48>) at /data/bld/11.3.1-asan/sql/mdl.cc:1214
      #9  0x00005579fbc09213 in MDL_context::acquire_lock (this=0x62c000220370, mdl_request=0x7f3298de3e40, lock_wait_timeout=86400) at /data/bld/11.3.1-asan/sql/mdl.cc:2408
      #10 0x00005579fbc0a5a4 in MDL_context::upgrade_shared_lock (this=0x62c000220370, mdl_ticket=0x60700002a9c0, new_type=MDL_EXCLUSIVE, lock_wait_timeout=86400) at /data/bld/11.3.1-asan/sql/mdl.cc:2617
      #11 0x00005579fb562eff in wait_while_table_is_used (thd=0x62c000220218, table=0x619000110898, function=HA_EXTRA_PREPARE_FOR_RENAME) at /data/bld/11.3.1-asan/sql/sql_base.cc:1405
      #12 0x00005579fba1656b in mysql_inplace_alter_table (thd=0x62c000220218, table_list=0x6290002da3a8, table=0x619000110898, altered_table=0x7f3298de5dc0, ha_alter_info=0x7f3298de5240, target_mdl_request=0x7f3298de5340, ddl_log_state=0x7f3298de4f70, trigger_param=0x7f3298de6210, alter_ctx=0x7f3298de6d60, partial_alter=@0x7f3298de4bf0: false, start_alter_id=@0x7f3298de4c30: 0, if_exists=false) at /data/bld/11.3.1-asan/sql/sql_table.cc:7806
      #13 0x00005579fba30d13 in mysql_alter_table (thd=0x62c000220218, new_db=0x5579fd7b9980 <null_clex_str>, new_name=0x5579fd7b9980 <null_clex_str>, create_info=0x7f3298de7ce0, table_list=0x6290002da3a8, recreate_info=0x7f3298de8310, alter_info=0x7f3298de7b30, order_num=0, order=0x0, ignore=false, if_exists=false) at /data/bld/11.3.1-asan/sql/sql_table.cc:11136
      #14 0x00005579fba3bf2e in mysql_recreate_table (thd=0x62c000220218, table_list=0x6290002da3a8, recreate_info=0x7f3298de8310, table_copy=false) at /data/bld/11.3.1-asan/sql/sql_table.cc:12429
      #15 0x00005579fbc13e99 in admin_recreate_table (thd=0x62c000220218, table_list=0x6290002da3a8, recreate_info=0x7f3298de8310) at /data/bld/11.3.1-asan/sql/sql_admin.cc:72
      #16 0x00005579fbc1c148 in mysql_admin_table (thd=0x62c000220218, tables=0x6290002da3a8, check_opt=0x62c0002259c0, operator_name=0x5579feca5540 <msg_optimize>, lock_type=TL_WRITE, org_open_for_modify=true, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=(int (handler::*)(handler * const, THD *, HA_CHECK_OPT *)) 0x5579fc07aece <handler::ha_optimize(THD*, st_ha_check_opt*)>, view_operator_func=0x0, is_cmd_replicated=true) at /data/bld/11.3.1-asan/sql/sql_admin.cc:1232
      #17 0x00005579fbc1f59b in Sql_cmd_optimize_table::execute (this=0x6290002db258, thd=0x62c000220218) at /data/bld/11.3.1-asan/sql/sql_admin.cc:1617
      #18 0x00005579fb72c2f5 in mysql_execute_command (thd=0x62c000220218, is_called_from_prepared_stmt=false) at /data/bld/11.3.1-asan/sql/sql_parse.cc:5738
      #19 0x00005579fb73973f in mysql_parse (thd=0x62c000220218, rawbuf=0x6290002da238 "OPTIMIZE TABLE mysql.innodb_table_stats, mysql.innodb_index_stats", length=65, parser_state=0x7f3298dea9f0) at /data/bld/11.3.1-asan/sql/sql_parse.cc:7749
      #20 0x00005579fb710f8a in dispatch_command (command=COM_QUERY, thd=0x62c000220218, packet=0x6290002d0219 "", packet_length=65, blocking=true) at /data/bld/11.3.1-asan/sql/sql_parse.cc:1893
      #21 0x00005579fb70dcc2 in do_command (thd=0x62c000220218, blocking=true) at /data/bld/11.3.1-asan/sql/sql_parse.cc:1406
      #22 0x00005579fbbdd9b7 in do_handle_one_connection (connect=0x608000003b38, put_in_cache=true) at /data/bld/11.3.1-asan/sql/sql_connect.cc:1418
      #23 0x00005579fbbdd378 in handle_one_connection (arg=0x608000003b38) at /data/bld/11.3.1-asan/sql/sql_connect.cc:1320
      #24 0x00005579fc81423a in pfs_spawn_thread (arg=0x617000008918) at /data/bld/11.3.1-asan/storage/perfschema/pfs.cc:2201
      #25 0x00007f32a6aa8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #26 0x00007f32a6b2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
      Thread 12 (Thread 0x7f3299ae26c0 (LWP 616445) "mariadbd"):
      #0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
      #1  0x00005579fce9fa03 in srw_mutex_impl<false>::wait (this=0x5579ff8bfcc8 <dict_sys+72>, lk=2147483651) at /data/bld/11.3.1-asan/storage/innobase/sync/srw_lock.cc:244
      #2  0x00005579fce9e1ed in srw_mutex_impl<false>::wait_and_lock (this=0x5579ff8bfcc8 <dict_sys+72>) at /data/bld/11.3.1-asan/storage/innobase/sync/srw_lock.cc:331
      #3  0x00005579fca72da7 in srw_mutex_impl<false>::wr_lock (this=0x5579ff8bfcc8 <dict_sys+72>) at /data/bld/11.3.1-asan/storage/innobase/include/srw_lock.h:134
      #4  0x00005579fce9edc0 in ssux_lock_impl<false>::rd_wait (this=0x5579ff8bfcc8 <dict_sys+72>) at /data/bld/11.3.1-asan/storage/innobase/sync/srw_lock.cc:397
      #5  0x00005579fca6f219 in ssux_lock_impl<false>::rd_lock (this=0x5579ff8bfcc8 <dict_sys+72>) at /data/bld/11.3.1-asan/storage/innobase/include/srw_lock.h:247
      #6  0x00005579fce9ef92 in srw_lock_impl<false>::psi_rd_lock (this=0x5579ff8bfcc0 <dict_sys+64>, file=0x5579fe491c00 "/data/bld/11.3.1-asan/storage/innobase/trx/trx0undo.cc", line=296) at /data/bld/11.3.1-asan/storage/innobase/sync/srw_lock.cc:454
      #7  0x00005579fca70a3f in srw_lock_impl<false>::rd_lock (this=0x5579ff8bfcc0 <dict_sys+64>, file=0x5579fe491c00 "/data/bld/11.3.1-asan/storage/innobase/trx/trx0undo.cc", line=296) at /data/bld/11.3.1-asan/storage/innobase/include/srw_lock.h:513
      #8  0x00005579fd06f557 in dict_sys_t::freeze (this=0x5579ff8bfc80 <dict_sys>, file=0x5579fe491c00 "/data/bld/11.3.1-asan/storage/innobase/trx/trx0undo.cc", line=296) at /data/bld/11.3.1-asan/storage/innobase/dict/dict0dict.cc:997
      #9  0x00005579fcf34fcd in UndorecApplier::apply_undo_rec (this=0x7f3299ad9160, rec=0x7f329e7e4110 "\0016\016") at /data/bld/11.3.1-asan/storage/innobase/trx/trx0undo.cc:296
      #10 0x00005579fcf2bc4a in trx_t::apply_log (this=0x7f329f486940) at /data/bld/11.3.1-asan/storage/innobase/trx/trx0undo.cc:365
      #11 0x00005579fcf1217f in trx_t::commit_low (this=0x7f329f486940, mtr=0x7f3299ad9950) at /data/bld/11.3.1-asan/storage/innobase/trx/trx0trx.cc:1549
      #12 0x00005579fcf14160 in trx_t::commit_persist (this=0x7f329f486940) at /data/bld/11.3.1-asan/storage/innobase/trx/trx0trx.cc:1590
      #13 0x00005579fcf14411 in trx_t::commit (this=0x7f329f486940) at /data/bld/11.3.1-asan/storage/innobase/trx/trx0trx.cc:1599
      #14 0x00005579fd0d4e7f in dict_stats_save (table_orig=0x618000027920, only_for_index=0x6160009d3320) at /data/bld/11.3.1-asan/storage/innobase/dict/dict0stats.cc:3407
      #15 0x00005579fd0d7587 in dict_stats_update_for_index (index=0x6160009d3320) at /data/bld/11.3.1-asan/storage/innobase/dict/dict0stats.cc:3930
      #16 0x00005579fcad8ded in alter_stats_norebuild (ha_alter_info=0x7f3299adc180, ctx=0x6290000fba18, thd=0x62c0001f0218) at /data/bld/11.3.1-asan/storage/innobase/handler/handler0alter.cc:11012
      #17 0x00005579fcae0aa3 in ha_innobase::commit_inplace_alter_table (this=0x61d0003048b8, altered_table=0x7f3299adcd00, ha_alter_info=0x7f3299adc180, commit=true) at /data/bld/11.3.1-asan/storage/innobase/handler/handler0alter.cc:11768
      #18 0x00005579fc07c2bd in handler::ha_commit_inplace_alter_table (this=0x61d0003048b8, altered_table=0x7f3299adcd00, ha_alter_info=0x7f3299adc180, commit=true) at /data/bld/11.3.1-asan/sql/handler.cc:5459
      #19 0x00005579fba16a90 in mysql_inplace_alter_table (thd=0x62c0001f0218, table_list=0x6290000fa348, table=0x6190000ff098, altered_table=0x7f3299adcd00, ha_alter_info=0x7f3299adc180, target_mdl_request=0x7f3299adc280, ddl_log_state=0x7f3299adbeb0, trigger_param=0x7f3299add150, alter_ctx=0x7f3299addca0, partial_alter=@0x7f3299adbb30: false, start_alter_id=@0x7f3299adbb70: 0, if_exists=false) at /data/bld/11.3.1-asan/sql/sql_table.cc:7860
      #20 0x00005579fba30d13 in mysql_alter_table (thd=0x62c0001f0218, new_db=0x62c0001f4f70, new_name=0x62c0001f53c8, create_info=0x7f3299adecd0, table_list=0x6290000fa348, recreate_info=0x7f3299adea80, alter_info=0x7f3299adeb20, order_num=0, order=0x0, ignore=false, if_exists=false) at /data/bld/11.3.1-asan/sql/sql_table.cc:11136
      #21 0x00005579fbbfc879 in Sql_cmd_alter_table::execute (this=0x6290000fab80, thd=0x62c0001f0218) at /data/bld/11.3.1-asan/sql/sql_alter.cc:701
      #22 0x00005579fb72c2f5 in mysql_execute_command (thd=0x62c0001f0218, is_called_from_prepared_stmt=false) at /data/bld/11.3.1-asan/sql/sql_parse.cc:5738
      #23 0x00005579fb73973f in mysql_parse (thd=0x62c0001f0218, rawbuf=0x6290000fa238 "ALTER TABLE t ADD KEY idx(f)", length=28, parser_state=0x7f3299ae09f0) at /data/bld/11.3.1-asan/sql/sql_parse.cc:7749
      #24 0x00005579fb710f8a in dispatch_command (command=COM_QUERY, thd=0x62c0001f0218, packet=0x629000285219 "ALTER TABLE t ADD KEY idx(f)", packet_length=28, blocking=true) at /data/bld/11.3.1-asan/sql/sql_parse.cc:1893
      #25 0x00005579fb70dcc2 in do_command (thd=0x62c0001f0218, blocking=true) at /data/bld/11.3.1-asan/sql/sql_parse.cc:1406
      #26 0x00005579fbbdd9b7 in do_handle_one_connection (connect=0x608000003ab8, put_in_cache=true) at /data/bld/11.3.1-asan/sql/sql_connect.cc:1418
      #27 0x00005579fbbdd378 in handle_one_connection (arg=0x608000003a38) at /data/bld/11.3.1-asan/sql/sql_connect.cc:1320
      #28 0x00005579fc81423a in pfs_spawn_thread (arg=0x617000008598) at /data/bld/11.3.1-asan/storage/perfschema/pfs.cc:2201
      #29 0x00007f32a6aa8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #30 0x00007f32a6b2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Assertion failure on the current 11.4:

      11.4 9945d482af1d3e3eb241c96da9659d4cf5d56118

      mariadbd: /data/bld/11.4-asan/storage/innobase/include/sux_lock.h:307: void sux_lock<ssux>::s_lock(const char*, unsigned int) [with ssux = ssux_lock]: Assertion `!have_x()' failed.
       
      #9  0x00007f44e5653e32 in __GI___assert_fail (assertion=0x562a06e68da0 "!have_x()", file=0x562a06e68de0 "/data/bld/11.4-asan/storage/innobase/include/sux_lock.h", line=307, function=0x562a06e68e40 "void sux_lock<ssux>::s_lock(const char*, unsigned int) [with ssux = ssux_lock]") at ./assert/assert.c:101
      #10 0x0000562a058380ad in sux_lock<ssux_lock>::s_lock (this=0x562a083d27c0 <dict_sys+64>, file=0x562a06f7b200 "/data/bld/11.4-asan/storage/innobase/trx/trx0undo.cc", line=304) at /data/bld/11.4-asan/storage/innobase/include/sux_lock.h:307
      #11 0x0000562a05b3f529 in dict_sys_t::freeze (this=0x562a083d2780 <dict_sys>, file=0x562a06f7b200 "/data/bld/11.4-asan/storage/innobase/trx/trx0undo.cc", line=304) at /data/bld/11.4-asan/storage/innobase/dict/dict0dict.cc:1001
      #12 0x0000562a059ffbbb in UndorecApplier::apply_undo_rec (this=0x7f44d7193490, rec=0x7f44dd0cc110 "\0017\016") at /data/bld/11.4-asan/storage/innobase/trx/trx0undo.cc:304
      #13 0x0000562a059f6702 in trx_t::apply_log (this=0x7f44ddf3e440) at /data/bld/11.4-asan/storage/innobase/trx/trx0undo.cc:373
      #14 0x0000562a059dca0d in trx_t::commit_low (this=0x7f44ddf3e440, mtr=0x7f44d7193c80) at /data/bld/11.4-asan/storage/innobase/trx/trx0trx.cc:1557
      #15 0x0000562a059de9ee in trx_t::commit_persist (this=0x7f44ddf3e440) at /data/bld/11.4-asan/storage/innobase/trx/trx0trx.cc:1598
      #16 0x0000562a05bc0a8a in trx_t::commit (this=0x7f44ddf3e440, deleted=std::vector of length 0, capacity 0) at /data/bld/11.4-asan/storage/innobase/dict/drop.cc:237
      #17 0x0000562a054fe5f7 in ha_innobase::delete_table (this=0x629000109ca8, name=0x7f44d7196060 "./test/t") at /data/bld/11.4-asan/storage/innobase/handler/ha_innodb.cc:13691
      #18 0x0000562a04b2a0a5 in hton_drop_table (hton=0x615000002898, path=0x7f44d7196060 "./test/t") at /data/bld/11.4-asan/sql/handler.cc:576
      #19 0x0000562a04b39f5c in ha_delete_table (thd=0x62c0001f0218, hton=0x615000002898, path=0x7f44d7196060 "./test/t", db=0x7f44d7195970, alias=0x7f44d7195990, generate_warning=true) at /data/bld/11.4-asan/sql/handler.cc:3218
      #20 0x0000562a044ae5d0 in mysql_rm_table_no_locks (thd=0x62c0001f0218, tables=0x629000109310, current_db=0x62c0001f02b8, ddl_log_state=0x7f44d7195a10, if_exists=false, drop_temporary=false, drop_view=false, drop_sequence=false, dont_log_query=false, dont_free_locks=false) at /data/bld/11.4-asan/sql/sql_table.cc:1631
      #21 0x0000562a044abfee in mysql_rm_table (thd=0x62c0001f0218, tables=0x629000109310, if_exists=false, drop_temporary=false, drop_sequence=false, dont_log_query=false) at /data/bld/11.4-asan/sql/sql_table.cc:1206
      #22 0x0000562a041e5e56 in mysql_execute_command (thd=0x62c0001f0218, is_called_from_prepared_stmt=false) at /data/bld/11.4-asan/sql/sql_parse.cc:4701
      #23 0x0000562a041fafc5 in mysql_parse (thd=0x62c0001f0218, rawbuf=0x629000109238 "DROP TABLE t", length=12, parser_state=0x7f44d71979f0) at /data/bld/11.4-asan/sql/sql_parse.cc:7798
      #24 0x0000562a041d260a in dispatch_command (command=COM_QUERY, thd=0x62c0001f0218, packet=0x629000285219 "DROP TABLE t", packet_length=12, blocking=true) at /data/bld/11.4-asan/sql/sql_parse.cc:1893
      #25 0x0000562a041cf342 in do_command (thd=0x62c0001f0218, blocking=true) at /data/bld/11.4-asan/sql/sql_parse.cc:1406
      #26 0x0000562a046a34c6 in do_handle_one_connection (connect=0x6080000038b8, put_in_cache=true) at /data/bld/11.4-asan/sql/sql_connect.cc:1417
      #27 0x0000562a046a2e87 in handle_one_connection (arg=0x608000003838) at /data/bld/11.4-asan/sql/sql_connect.cc:1319
      #28 0x0000562a052db280 in pfs_spawn_thread (arg=0x617000008598) at /data/bld/11.4-asan/storage/perfschema/pfs.cc:2201
      #29 0x00007f44e56a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #30 0x00007f44e572861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              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.