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

Server deadlocks on renaming a table for which persistent statistics exists

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.0(EOL)
    • 10.0.23
    • Optimizer

    Description

      With the following test case, server hangs seemingly forever on RENAME TABLE. Reducing lock_wait_timeout does not help. Happens both with MyISAM and InnoDB. If persistent statistics is not collected, there is no hang up. Reproducible on debug and release builds.

      create database db1;
      create database db2;
      use db1;
      create table t1 (i int);
      analyze table t1 persistent for all;
      rename table t1 to db2.t1;
       
      # Cleanup
      drop database db1;
      drop database db2;

      Stack trace from 10.0 revno 4543 on the hanging server

      #0  __pthread_getspecific (key=3) at pthread_getspecific.c:32
      #1  0x0000000000e49570 in my_thread_var_dbug () at 10.0/mysys/my_thr_init.c:432
      #2  0x0000000000e65dd8 in code_state () at 10.0/dbug/dbug.c:350
      #3  0x0000000000e682ba in _db_pargs_ (_line_=409, keyword=0x1129515 "mutex") at 10.0/dbug/dbug.c:1228
      #4  0x0000000000e50314 in safe_mutex_unlock (mp=0x7f42bf81fd28, file=0x1124638 "10.0/mysys/mf_keycache.c", line=2879) at 10.0/mysys/thr_mutex.c:409
      #5  0x0000000000e2c6d9 in inline_mysql_mutex_unlock (that=0x7f42bf81fd28, src_file=0x1124638 "10.0/mysys/mf_keycache.c", src_line=2879) at 10.0/include/mysql/p
      si/mysql_thread.h:761
      #6  0x0000000000e30c48 in simple_key_cache_read (keycache=0x7f42bf81fc70, file=61, filepos=6144, level=3, buff=0x7f42b86b9cb0 "", length=1024, block_length=3072, return_buffer=1) at /home/elens
      t/bzr/10.0/mysys/mf_keycache.c:2879
      #7  0x0000000000e34d0f in key_cache_read (keycache=0x7f42bf827270, file=61, filepos=4096, level=3, buff=0x7f42b86b94b0 "", length=3072, block_length=3072, return_buffer=1) at 1
      0.0/mysys/mf_keycache.c:6211
      #8  0x0000000000dd9943 in _mi_fetch_keypage (info=0x7f42b86b9070, keyinfo=0x7f42b84a0e70, page=4096, level=3, buff=0x7f42b86b94b0 "", return_buffer=1) at 10.0/storage/myisam/mi
      _page.c:32
      #9  0x0000000000ddd20d in _mi_search (info=0x7f42b86b9070, keyinfo=0x7f42b84a0e70, key=0x7f42b86bb15e "\003db1\002t1\001i", key_len=7, nextflag=1, pos=4096) at 10.0/storage/myisam/mi_search.c:85
      #10 0x0000000000dfcdc1 in mi_rkey (info=0x7f42b86b9070, buf=0x7f42b8622088 "\337\003db1\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\002t1\217\217\217"..., inx=0, key=0x7f42c2299d80 "\003", keypart_map=3, search_flag=HA_READ_KEY_EXACT) at 10.0/storage/myisam/mi_rkey.c:99
      #11 0x0000000000da7112 in ha_myisam::index_read_idx_map (this=0x7f42b847f088, buf=0x7f42b8622088 "\337\003db1\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\002t1\217\217\217"..., index=0, key=0x7f42c2299d80 "\003", keypart_map=3, find_flag=HA_READ_KEY_EXACT) at 10.0/storage/myisam/ha_myisam.cc:1743
      #12 0x000000000086e45c in handler::ha_index_read_idx_map (this=0x7f42b847f088, buf=0x7f42b8622088 "\337\003db1\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\002t1\217\217\217"..., index=0, key=0x7f42c2299d80 "\003", keypart_map=3, find_flag=HA_READ_KEY_EXACT) at 10.0/sql/handler.cc:2614
      #13 0x00000000007164be in Stat_table::find_next_stat_for_prefix (this=0x7f42c229aac0, prefix_parts=2) at 10.0/sql/sql_statistics.cc:493
      #14 0x00000000007146bf in rename_table_in_stat_tables (thd=0x7f42baf2f070, db=0x7f42c229be00, tab=0x7f42c229bdf0, new_db=0x7f42c229be00, new_tab=0x7f42c229bde0) at 10.0/sql/sql_statistics.cc:3294
      #15 0x00000000006a0267 in do_rename (thd=0x7f42baf2f070, ren_table=0x7f42b84141a0, new_db=0x7f42b8414160 "db2", new_table_name=0x7f42b8414168 "t1", new_table_alias=0x7f42b8414780 "t1", skip_error=false) at 10.0/sql/sql_rename.cc:283
      #16 0x00000000006a0461 in rename_tables (thd=0x7f42baf2f070, table_list=0x7f42b84141a0, skip_error=false) at 10.0/sql/sql_rename.cc:358
      #17 0x000000000069fe39 in mysql_rename_tables (thd=0x7f42baf2f070, table_list=0x7f42b84141a0, silent=false) at 10.0/sql/sql_rename.cc:153
      #18 0x00000000006836b4 in execute_rename_table (thd=0x7f42baf2f070, first_table=0x7f42b84141a0, all_tables=0x7f42b84141a0) at 10.0/sql/sql_parse.cc:5331
      #19 0x000000000067cd8c in mysql_execute_command (thd=0x7f42baf2f070) at 10.0/sql/sql_parse.cc:3172
      #20 0x00000000006859bd in mysql_parse (thd=0x7f42baf2f070, rawbuf=0x7f42b8414088 "rename table t1 to db2.t1", length=25, parser_state=0x7f42c229d610) at 10.0/sql/sql_parse.cc:6407
      #21 0x00000000006787b2 in dispatch_command (command=COM_QUERY, thd=0x7f42baf2f070, packet=0x7f42bbff6071 "rename table t1 to db2.t1", packet_length=25) at 10.0/sql/sql_parse.cc:1299
      #22 0x0000000000677b57 in do_command (thd=0x7f42baf2f070) at 10.0/sql/sql_parse.cc:996

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            3 Vote for this issue
            Watchers:
            8 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.