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

Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock on INSERT

    XMLWordPrintable

Details

    Description

      SET unique_checks=0,foreign_key_checks=0,autocommit=0;
      CREATE TABLE t1 (c INT) ENGINE=InnoDB;
      CREATE TABLE t2 (c INT) ENGINE=InnoDB;
      LOCK TABLE t2 WRITE;
      INSERT INTO t2 VALUES (1);
      CREATE TABLE t1 (c INT) ENGINE=InnoDB;
      CREATE TEMPORARY TABLE t3 (a INT) ENGINE=InnoDB;
      INSERT INTO t3 VALUES (1);
      INSERT INTO t2 VALUES (2);
      

      Leads to:

      10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

      mysqld: /test/10.6_dbg/storage/innobase/lock/lock0lock.cc:4695: dberr_t lock_rec_insert_check_and_lock(const rec_t*, buf_block_t*, dict_index_t*, que_thr_t*, mtr_t*, bool*): Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed.
      

      10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Debug)

      Core was generated by `/test/MD150421-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x14a0f075f700 (LWP 300047))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014a0f331d859 in __GI_abort () at abort.c:79
      #2  0x000014a0f331d729 in __assert_fail_base (fmt=0x14a0f34b3588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x559157c328c8 "lock_table_has(trx, index->table, LOCK_IX)", file=0x559157c304d0 "/test/10.6_dbg/storage/innobase/lock/lock0lock.cc", line=4695, function=<optimized out>) at assert.c:92
      #3  0x000014a0f332ef36 in __GI___assert_fail (assertion=assertion@entry=0x559157c328c8 "lock_table_has(trx, index->table, LOCK_IX)", file=file@entry=0x559157c304d0 "/test/10.6_dbg/storage/innobase/lock/lock0lock.cc", line=line@entry=4695, function=function@entry=0x559157c32800 "dberr_t lock_rec_insert_check_and_lock(const rec_t*, buf_block_t*, dict_index_t*, que_thr_t*, mtr_t*, bool*)") at assert.c:101
      #4  0x0000559157495869 in lock_rec_insert_check_and_lock (rec=rec@entry=0x14a0d069807e "", block=0x14a0d0011020, index=index@entry=0x14a0900263e8, thr=thr@entry=0x14a09002bc60, mtr=mtr@entry=0x14a0f075cc70, inherit=inherit@entry=0x14a0f075c297) at /test/10.6_dbg/storage/innobase/lock/lock0lock.cc:4695
      #5  0x00005591576779d0 in btr_cur_ins_lock_and_undo (flags=flags@entry=0, cursor=cursor@entry=0x14a0f075c6c0, entry=entry@entry=0x14a090022e48, thr=thr@entry=0x14a09002bc60, mtr=mtr@entry=0x14a0f075cc70, inherit=inherit@entry=0x14a0f075c297) at /test/10.6_dbg/storage/innobase/include/btr0cur.ic:61
      #6  0x000055915767e79f in btr_cur_optimistic_insert (flags=flags@entry=0, cursor=cursor@entry=0x14a0f075c6c0, offsets=offsets@entry=0x14a0f075c688, heap=heap@entry=0x14a0f075c680, entry=entry@entry=0x14a090022e48, rec=rec@entry=0x14a0f075c698, big_rec=0x14a0f075c678, n_ext=<optimized out>, thr=0x14a09002bc60, mtr=0x14a0f075cc70) at /test/10.6_dbg/storage/innobase/btr/btr0cur.cc:3526
      #7  0x000055915755776c in row_ins_clust_index_entry_low (flags=flags@entry=0, mode=<optimized out>, mode@entry=2, index=index@entry=0x14a0900263e8, n_uniq=n_uniq@entry=0, entry=entry@entry=0x14a090022e48, n_ext=n_ext@entry=0, thr=<optimized out>) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:2790
      #8  0x0000559157559331 in row_ins_clust_index_entry (index=index@entry=0x14a0900263e8, entry=entry@entry=0x14a090022e48, thr=thr@entry=0x14a09002bc60, n_ext=n_ext@entry=0) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3263
      #9  0x000055915755df0a in row_ins_index_entry (thr=0x14a09002bc60, entry=0x14a090022e48, index=0x14a0900263e8) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3388
      #10 row_ins_index_entry_step (thr=0x14a09002bc60, node=0x14a09002ba48) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3557
      #11 row_ins (thr=0x14a09002bc60, node=0x14a09002ba48) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3703
      #12 row_ins_step (thr=thr@entry=0x14a09002bc60) at /test/10.6_dbg/storage/innobase/row/row0ins.cc:3845
      #13 0x00005591575828e0 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x14a090028b58 "\375\002", prebuilt=0x14a09002b318, ins_mode=ROW_INS_NORMAL) at /test/10.6_dbg/storage/innobase/row/row0mysql.cc:1395
      #14 0x000055915740873a in ha_innobase::write_row (this=0x14a090028fc0, record=0x14a090028b58 "\375\002") at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:7424
      #15 0x0000559157013f0d in handler::ha_write_row (this=0x14a090028fc0, buf=0x14a090028b58 "\375\002") at /test/10.6_dbg/sql/handler.cc:7156
      #16 0x0000559156cedbfd in write_record (thd=thd@entry=0x14a090000db8, table=table@entry=0x14a090020048, info=info@entry=0x14a0f075dd00, sink=sink@entry=0x0) at /test/10.6_dbg/sql/sql_insert.cc:2106
      #17 0x0000559156cf9474 in mysql_insert (thd=thd@entry=0x14a090000db8, table_list=0x14a090013c88, fields=@0x14a090005e60: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55915830f280 <end_of_list>, last = 0x14a090005e60, elements = 0}, <No data fields>}, values_list=@0x14a090005ea8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14a0900148b8, last = 0x14a0900148b8, elements = 1}, <No data fields>}, update_fields=@0x14a090005e90: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55915830f280 <end_of_list>, last = 0x14a090005e90, elements = 0}, <No data fields>}, update_values=@0x14a090005e78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55915830f280 <end_of_list>, last = 0x14a090005e78, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.6_dbg/sql/sql_insert.cc:1099
      #18 0x0000559156d401ac in mysql_execute_command (thd=thd@entry=0x14a090000db8) at /test/10.6_dbg/sql/sql_parse.cc:4559
      #19 0x0000559156d2aa06 in mysql_parse (thd=thd@entry=0x14a090000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14a0f075e410) at /test/10.6_dbg/sql/sql_parse.cc:8017
      #20 0x0000559156d397df in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a090000db8, packet=packet@entry=0x14a09000b369 "INSERT INTO t2 VALUES (2)", packet_length=packet_length@entry=25, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1331
      #21 0x0000559156d3cbd5 in do_command (thd=0x14a090000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
      #22 0x0000559156e9677c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5591595116c8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
      #23 0x0000559156e96d81 in handle_one_connection (arg=arg@entry=0x5591595116c8) at /test/10.6_dbg/sql/sql_connect.cc:1312
      #24 0x0000559157344a03 in pfs_spawn_thread (arg=0x559159427a88) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
      #25 0x000014a0f382b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #26 0x000014a0f341a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      10.6.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (dbg), 10.4.19 (opt), 10.5.10 (dbg), 10.5.10 (opt), 10.6.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)

      Optimized output:

      10.6.0 a3e3225cd3b816d47621e749e21a71b6a864a96a (Optimized)

      10.6.0-opt>SET unique_checks=0,foreign_key_checks=0,autocommit=0;
      Query OK, 0 rows affected (0.000 sec)
       
      10.6.0-opt>CREATE TABLE t1 (c INT) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.019 sec)
       
      10.6.0-opt>CREATE TABLE t2 (c INT) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.012 sec)
       
      10.6.0-opt>LOCK TABLE t2 WRITE;
      Query OK, 0 rows affected (0.001 sec)
       
      10.6.0-opt>INSERT INTO t2 VALUES (1);
      Query OK, 1 row affected (0.007 sec)
       
      10.6.0-opt>CREATE TABLE t1 (c INT) ENGINE=InnoDB;
      ERROR 1100 (HY000): Table 't1' was not locked with LOCK TABLES
      10.6.0-opt>CREATE TEMPORARY TABLE t3 (a INT) ENGINE=InnoDB;
      Query OK, 0 rows affected (0.002 sec)
       
      10.6.0-opt>INSERT INTO t3 VALUES (1);
      Query OK, 1 row affected (0.000 sec)
       
      10.6.0-opt>INSERT INTO t2 VALUES (2);
      Query OK, 1 row affected (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              Roel Roel Van de Paar
              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.