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

Optimize table should take MDL before ha_innobase::optimize()

    XMLWordPrintable

Details

    Description

      Note: Compound statements play no role in the problem, it's just in the test case to allow parallel execution.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (c TINYTEXT, FULLTEXT KEY (c)) ENGINE=InnoDB;
      INSERT INTO t1 (c) VALUES ('foo'),('bar');
      SET GLOBAL innodb_optimize_fulltext_only = 1;
       
      --connect (con1,localhost,root,,)
      --let $con1= `SELECT CONNECTION_ID()`
      --delimiter $
      --send
        LOOP
          OPTIMIZE TABLE t1;
        END LOOP $
      --delimiter ;
       
      --connection default
      --let $n= 50
      while ($n)
      {
        UPDATE t1 SET c = CONCAT('foo',RAND());
        OPTIMIZE TABLE t1;
        --dec $n
      }
       
      # Cleanup
      --eval KILL $con1
      DROP TABLE t1;
      SET GLOBAL innodb_optimize_fulltext_only = DEFAULT;
      

      10.2 b546e92a

      2019-05-17 01:36:26 0x7f2bc19aa700  InnoDB: Assertion failure in file /data/src/10.2/storage/innobase/fts/fts0opt.cc line 1799
      InnoDB: Failing assertion: ib_vector_size(optim->words) > 0
       
      #5  0x00007f2bc73b042a in __GI_abort () at abort.c:89
      #6  0x00005585a408998c in ut_dbg_assertion_failed (expr=0x5585a46c1668 "ib_vector_size(optim->words) > 0", file=0x5585a46c0d78 "/data/src/10.2/storage/innobase/fts/fts0opt.cc", line=1799) at /data/src/10.2/storage/innobase/ut/ut0dbg.cc:60
      #7  0x00005585a41bbe0e in fts_optimize_words (optim=0x7f2b64037448, index=0x7f2b6c076138, word=0x7f2bc19a69f0) at /data/src/10.2/storage/innobase/fts/fts0opt.cc:1799
      #8  0x00005585a41bc5b8 in fts_optimize_index (optim=0x7f2b64037448, index=0x7f2b6c076138) at /data/src/10.2/storage/innobase/fts/fts0opt.cc:1988
      #9  0x00005585a41bcf38 in fts_optimize_indexes (optim=0x7f2b64037448) at /data/src/10.2/storage/innobase/fts/fts0opt.cc:2292
      #10 0x00005585a41bd2f5 in fts_optimize_table (table=0x7f2b6c17eb88) at /data/src/10.2/storage/innobase/fts/fts0opt.cc:2469
      #11 0x00005585a3e8c7c4 in ha_innobase::optimize (this=0x7f2b64034c58, thd=0x7f2b64000b00, check_opt=0x7f2b6401bcb0) at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:14710
      #12 0x00005585a3c7b48d in handler::ha_optimize (this=0x7f2b64034c58, thd=0x7f2b64000b00, check_opt=0x7f2b6401bcb0) at /data/src/10.2/sql/handler.cc:4209
      #13 0x00005585a3b555f4 in mysql_admin_table(THD *, TABLE_LIST *, HA_CHECK_OPT *, const char *, thr_lock_type, bool, bool, uint, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *), struct {...}, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *)) (thd=0x7f2b64000b00, tables=0x7f2b64018fc0, check_opt=0x7f2b6401bcb0, operator_name=0x5585a44bc008 "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 *)) 0x5585a3c7b40c <handler::ha_optimize(THD*, st_ha_check_opt*)>, view_operator_func=0x0) at /data/src/10.2/sql/sql_admin.cc:799
      #14 0x00005585a3b5790b in Sql_cmd_optimize_table::execute (this=0x7f2b640195d8, thd=0x7f2b64000b00) at /data/src/10.2/sql/sql_admin.cc:1360
      #15 0x00005585a39ff386 in mysql_execute_command (thd=0x7f2b64000b00) at /data/src/10.2/sql/sql_parse.cc:6233
      #16 0x00005585a3def39e in sp_instr_stmt::exec_core (this=0x7f2b640195e0, thd=0x7f2b64000b00, nextp=0x7f2bc19a81b4) at /data/src/10.2/sql/sp_head.cc:3248
      #17 0x00005585a3deea17 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f2b64019620, thd=0x7f2b64000b00, nextp=0x7f2bc19a81b4, open_tables=false, instr=0x7f2b640195e0) at /data/src/10.2/sql/sp_head.cc:3011
      #18 0x00005585a3def04f in sp_instr_stmt::execute (this=0x7f2b640195e0, thd=0x7f2b64000b00, nextp=0x7f2bc19a81b4) at /data/src/10.2/sql/sp_head.cc:3164
      #19 0x00005585a3dea216 in sp_head::execute (this=0x7f2b640182f8, thd=0x7f2b64000b00, merge_da_on_success=true) at /data/src/10.2/sql/sp_head.cc:1329
      #20 0x00005585a3dec296 in sp_head::execute_procedure (this=0x7f2b640182f8, thd=0x7f2b64000b00, args=0x7f2b64005430) at /data/src/10.2/sql/sp_head.cc:2118
      #21 0x00005585a39f4aac in do_execute_sp (thd=0x7f2b64000b00, sp=0x7f2b640182f8) at /data/src/10.2/sql/sql_parse.cc:2956
      #22 0x00005585a39fdd2c in mysql_execute_command (thd=0x7f2b64000b00) at /data/src/10.2/sql/sql_parse.cc:5844
      #23 0x00005585a3a044aa in mysql_parse (thd=0x7f2b64000b00, rawbuf=0x7f2b64011098 "BEGIN NOT ATOMIC\nLOOP\nOPTIMIZE TABLE t1;\nEND LOOP;\nEND", length=54, parser_state=0x7f2bc19a9200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8020
      #24 0x00005585a39f1cfe in dispatch_command (command=COM_QUERY, thd=0x7f2b64000b00, packet=0x7f2b640088b1 "", packet_length=55, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1833
      #25 0x00005585a39f0652 in do_command (thd=0x7f2b64000b00) at /data/src/10.2/sql/sql_parse.cc:1386
      #26 0x00005585a3b43328 in do_handle_one_connection (connect=0x5585a6f0f6a0) at /data/src/10.2/sql/sql_connect.cc:1335
      #27 0x00005585a3b430a8 in handle_one_connection (arg=0x5585a6f0f6a0) at /data/src/10.2/sql/sql_connect.cc:1241
      #28 0x00005585a436e26e in pfs_spawn_thread (arg=0x5585a6e5b2f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #29 0x00007f2bc8f1c4a4 in start_thread (arg=0x7f2bc19aa700) at pthread_create.c:456
      #30 0x00007f2bc7464d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Debug, ASAN, non-debug all fail the same way.
      Couldn't reproduce on 10.1.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.