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

Assertion `m_lock_type == 2' failed in handler::ha_drop_table upon LOAD DATA

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (a INT);
      CREATE VIEW v1 AS SELECT * FROM t1;
      CREATE OR REPLACE TABLE t1 (b INT) WITH SYSTEM VERSIONING;
      --error ER_VIEW_INVALID
      LOAD DATA INFILE 'xx' INTO TABLE v1;
       
      # Cleanup
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.3 0076dce2c

      mysqld: /data/src/10.3-bug-post/sql/handler.cc:4696: void handler::ha_drop_table(const char*): Assertion `m_lock_type == 2' failed.
      191126  2:51:53 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f512d698f12 in __GI___assert_fail (assertion=0x555d32724dc3 "m_lock_type == 2", file=0x555d32723ce0 "/data/src/10.3-bug-post/sql/handler.cc", line=4696, function=0x555d327276e0 <handler::ha_drop_table(char const*)::__PRETTY_FUNCTION__> "void handler::ha_drop_table(const char*)") at assert.c:101
      #8  0x0000555d31c7e3f0 in handler::ha_drop_table (this=0x7f510c1211d8, name=0x7f510c096d10 "./test/t1") at /data/src/10.3-bug-post/sql/handler.cc:4696
      #9  0x0000555d319d2b30 in free_tmp_table (thd=0x7f510c000af0, entry=0x7f510c120590) at /data/src/10.3-bug-post/sql/sql_select.cc:18863
      #10 0x0000555d3190d5a9 in mysql_derived_prepare (thd=0x7f510c000af0, lex=0x7f510c0048f8, derived=0x7f510c012958) at /data/src/10.3-bug-post/sql/sql_derived.cc:821
      #11 0x0000555d3190bf7e in mysql_handle_single_derived (lex=0x7f510c0048f8, derived=0x7f510c012958, phases=2) at /data/src/10.3-bug-post/sql/sql_derived.cc:199
      #12 0x0000555d31a87d02 in TABLE_LIST::handle_derived (this=0x7f510c012958, lex=0x7f510c0048f8, phases=2) at /data/src/10.3-bug-post/sql/table.cc:8282
      #13 0x0000555d3192570e in LEX::handle_list_of_derived (this=0x7f510c0048f8, table_list=0x7f510c012958, phases=2) at /data/src/10.3-bug-post/sql/sql_lex.h:4019
      #14 0x0000555d31948933 in mysql_load (thd=0x7f510c000af0, ex=0x7f510c0128d0, table_list=0x7f510c012958, fields_vars=..., set_fields=..., set_values=..., handle_duplicates=DUP_ERROR, ignore=false, read_file_from_client=false) at /data/src/10.3-bug-post/sql/sql_load.cc:411
      #15 0x0000555d3195e7c2 in mysql_execute_command (thd=0x7f510c000af0) at /data/src/10.3-bug-post/sql/sql_parse.cc:4873
      #16 0x0000555d31968577 in mysql_parse (thd=0x7f510c000af0, rawbuf=0x7f510c012808 "LOAD DATA INFILE 'xx' INTO TABLE v1", length=35, parser_state=0x7f51280985e0, is_com_multi=false, is_next_command=false) at /data/src/10.3-bug-post/sql/sql_parse.cc:7818
      #17 0x0000555d319550c3 in dispatch_command (command=COM_QUERY, thd=0x7f510c000af0, packet=0x7f510c008c61 "LOAD DATA INFILE 'xx' INTO TABLE v1", packet_length=35, is_com_multi=false, is_next_command=false) at /data/src/10.3-bug-post/sql/sql_parse.cc:1856
      #18 0x0000555d31953a0b in do_command (thd=0x7f510c000af0) at /data/src/10.3-bug-post/sql/sql_parse.cc:1401
      #19 0x0000555d31acae4c in do_handle_one_connection (connect=0x555d351c51b0) at /data/src/10.3-bug-post/sql/sql_connect.cc:1403
      #20 0x0000555d31acabae in handle_one_connection (arg=0x555d351c51b0) at /data/src/10.3-bug-post/sql/sql_connect.cc:1308
      #21 0x0000555d324774ee in pfs_spawn_thread (arg=0x555d351e0170) at /data/src/10.3-bug-post/storage/perfschema/pfs.cc:1862
      #22 0x00007f512f20e4a4 in start_thread (arg=0x7f5128099700) at pthread_create.c:456
      #23 0x00007f512d755d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.3-10.5.

      The problem appeared in 10.3 with this commit:

      commit 0076dce2c89248b6c0252ec4385879194f9aadbf
      Author: Aleksey Midenkov
      Date:   Fri Nov 22 14:29:03 2019 +0300
       
          MDEV-18727 improve DML operation of System Versioning
          MDEV-18957 UPDATE with LIMIT clause is wrong for versioned partitioned tables
          
          UPDATE, DELETE: replace linear search of current/historical records
          with vers_setup_conds().
          
          Additional DML cases in view.test
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: