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

Assertion `(*tables)->reginfo.lock_type >= TL_READ' failed in lock_external upon using a mix of trigger, view, SP

    XMLWordPrintable

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL), 11.3(EOL), 11.4, 11.5(EOL)
    • 10.5, 10.6, 10.11, 11.4
    • Locking

    Description

      CREATE TABLE t (i INT);
      CREATE VIEW v AS SELECT * FROM t;
      CREATE PROCEDURE p() CREATE VIEW v AS SELECT * FROM t;
      CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW CALL p();
      --error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
      INSERT INTO t VALUES (1),(2);
       
      # Cleanup
      DROP PROCEDURE p;
      DROP VIEW v;
      DROP TABLE t;
      

      10.0 3d4beee1a98ce

      mysqld: /data/src/10.0/sql/lock.cc:351: int lock_external(THD*, TABLE**, uint): Assertion `(*tables)->reginfo.lock_type >= TL_READ' failed.
      180704 18:05:54 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f8052378ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000000000091f457 in lock_external (thd=0x7f804c2a8070, tables=0x7f804a753468, count=3) at /data/src/10.0/sql/lock.cc:351
      #9  0x000000000091f20e in mysql_lock_tables (thd=0x7f804c2a8070, sql_lock=0x7f804a753410, flags=0) at /data/src/10.0/sql/lock.cc:308
      #10 0x000000000091f120 in mysql_lock_tables (thd=0x7f804c2a8070, tables=0x7f804a517b48, count=3, flags=0) at /data/src/10.0/sql/lock.cc:274
      #11 0x00000000005f1599 in lock_tables (thd=0x7f804c2a8070, tables=0x7f804a4fa170, count=3, flags=0) at /data/src/10.0/sql/sql_base.cc:5424
      #12 0x00000000005f105f in open_and_lock_tables (thd=0x7f804c2a8070, tables=0x7f804a4fa170, derived=true, flags=0, prelocking_strategy=0x7f80543fe990) at /data/src/10.0/sql/sql_base.cc:5252
      #13 0x00000000005e5331 in open_and_lock_tables (thd=0x7f804c2a8070, tables=0x7f804a4fa170, derived=true, flags=0) at /data/src/10.0/sql/sql_base.h:496
      #14 0x000000000062ee80 in mysql_insert (thd=0x7f804c2a8070, table_list=0x7f804a4fa170, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.0/sql/sql_insert.cc:724
      #15 0x000000000064f694 in mysql_execute_command (thd=0x7f804c2a8070) at /data/src/10.0/sql/sql_parse.cc:3450
      #16 0x0000000000657dd6 in mysql_parse (thd=0x7f804c2a8070, rawbuf=0x7f804a4fa088 "INSERT INTO t VALUES (1),(2)", length=28, parser_state=0x7f80543ff640) at /data/src/10.0/sql/sql_parse.cc:6634
      #17 0x000000000064a6f6 in dispatch_command (command=COM_QUERY, thd=0x7f804c2a8070, packet=0x7f804d7e5071 "INSERT INTO t VALUES (1),(2)", packet_length=28) at /data/src/10.0/sql/sql_parse.cc:1297
      #18 0x00000000006499f6 in do_command (thd=0x7f804c2a8070) at /data/src/10.0/sql/sql_parse.cc:1000
      #19 0x000000000076a872 in do_handle_one_connection (thd_arg=0x7f804c2a8070) at /data/src/10.0/sql/sql_connect.cc:1377
      #20 0x000000000076a5e4 in handle_one_connection (arg=0x7f804c2a8070) at /data/src/10.0/sql/sql_connect.cc:1292
      #21 0x0000000000acc722 in pfs_spawn_thread (arg=0x7f804c1a25f0) at /data/src/10.0/storage/perfschema/pfs.cc:1861
      #22 0x00007f805407c494 in start_thread (arg=0x7f8054400700) at pthread_create.c:333
      #23 0x00007f805243593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      No visible effect on non-debug builds. However a more complicated and dirtier test case having the same elements (triggers, views, SPs) causes a failure on a non-debug build too (while the same assertion failure on a debug build):

      10.4 86351f5e

      #2  <signal handler called>
      #3  0x00005613152de8fb in inline_mysql_cond_signal (that=<optimized out>) at /data/src/10.4/include/mysql/psi/mysql_thread.h:1232
      #4  wake_up_waiters (lock=lock@entry=0x7f364404f8b0) at /data/src/10.4/mysys/thr_lock.c:1105
      #5  0x00005613152df24d in wake_up_waiters (lock=<optimized out>) at /data/src/10.4/mysys/thr_lock.c:1013
      #6  wait_for_lock (wait=0x7f364404f918, data=data@entry=0x7f363c073540, in_wait_list=in_wait_list@entry=0 '\000', lock_wait_timeout=lock_wait_timeout@entry=5) at /data/src/10.4/mysys/thr_lock.c:608
      #7  0x00005613152df923 in thr_lock (lock_wait_timeout=5, owner=0x7f3638002760, data=0x7f363c073540) at /data/src/10.4/mysys/thr_lock.c:887
      #8  thr_multi_lock (data=0x7f3638011270, count=<optimized out>, owner=0x7f3638002760, lock_wait_timeout=5) at /data/src/10.4/mysys/thr_lock.c:1168
      #9  0x0000561314f41fb2 in mysql_lock_tables (thd=thd@entry=0x7f3638000c58, sql_lock=sql_lock@entry=0x7f3638011248, flags=flags@entry=0) at /data/src/10.4/sql/lock.cc:352
      #10 0x0000561314f42a04 in mysql_lock_tables (thd=thd@entry=0x7f3638000c58, tables=0x7f3638011240, count=count@entry=1, flags=flags@entry=0) at /data/src/10.4/sql/lock.cc:304
      #11 0x0000561314c1839a in lock_tables (thd=thd@entry=0x7f3638000c58, tables=0x7f3638010268, count=<optimized out>, flags=flags@entry=0) at /data/src/10.4/sql/sql_base.cc:5567
      #12 0x0000561314d237e8 in mysql_update (thd=thd@entry=0x7f3638000c58, table_list=<optimized out>, fields=..., values=..., conds=<optimized out>, order_num=1, order=0x7f3638011078, limit=18446744073709551615, ignore=true, found_return=0x7f369842af20, updated_return=0x7f369842afe0) at /data/src/10.4/sql/sql_update.cc:448
      #13 0x0000561314c75c6b in mysql_execute_command (thd=thd@entry=0x7f3638000c58) at /data/src/10.4/sql/sql_parse.cc:4451
      #14 0x0000561314c797c0 in mysql_parse (thd=0x7f3638000c58, rawbuf=<optimized out>, length=76, parser_state=0x7f369842b540, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.4/sql/sql_parse.cc:8013
      #15 0x0000561314c7b0ad in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f3638000c58, packet=packet@entry=0x7f3638007e09 "UPDATE IGNORE test.rpl_4 SET c = 'account' WHERE pad = 'plunge' ORDER BY pad", packet_length=packet_length@entry=76, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:1960
      #16 0x0000561314c7cfa8 in do_command (thd=0x7f3638000c58) at /data/src/10.4/sql/sql_parse.cc:1378
      #17 0x0000561314d62e54 in do_handle_one_connection (connect=connect@entry=0x561318590498) at /data/src/10.4/sql/sql_connect.cc:1420
      #18 0x0000561314d62fa4 in handle_one_connection (arg=arg@entry=0x561318590498) at /data/src/10.4/sql/sql_connect.cc:1324
      #19 0x0000561315082cd0 in pfs_spawn_thread (arg=0x561318513468) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #20 0x00007f369ebc9044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #21 0x00007f369ec4961c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      or a non-debug assertion failure

      11.2 a05b5dd5

      mariadbd: /data/src/11.2/storage/perfschema/pfs.cc:2997: PFS_TL_LOCK_TYPE lock_flags_to_lock_type(uint): Assertion `false' failed.
      231103 17:56:18 [ERROR] mysqld got signal 6 ;
       
      #8  0x00007f3a5b853e32 in __GI___assert_fail (assertion=0x559b4c682def "false", file=0x559b4c7df120 "/data/src/11.2/storage/perfschema/pfs.cc", line=2997, function=0x559b4c7e0c10 "PFS_TL_LOCK_TYPE lock_flags_to_lock_type(uint)") at ./assert/assert.c:101
      #9  0x0000559b4c19931c in lock_flags_to_lock_type (flags=<optimized out>) at /data/src/11.2/storage/perfschema/pfs.cc:2997
      #10 pfs_start_table_lock_wait_v1 (state=0x7f3a45cc88b0, table=0x7f3a240549c0, op=PSI_TABLE_LOCK, op_flags=<optimized out>, src_file=0x559b4c8529e0 "/data/src/11.2/mysys/thr_lock.c", src_line=653) at /data/src/11.2/storage/perfschema/pfs.cc:3142
      #11 0x0000559b4c486a55 in inline_mysql_start_table_lock_wait (src_line=653, src_file=0x559b4c8529e0 "/data/src/11.2/mysys/thr_lock.c", flags=0, op=PSI_TABLE_LOCK, psi=0x7f3a240549c0, state=0x7f3a45cc88b0) at /data/src/11.2/include/mysql/psi/mysql_table.h:143
      #12 thr_lock (lock_wait_timeout=5, owner=0x7f3a1c002a30, data=0x7f3a2493d4b0) at /data/src/11.2/mysys/thr_lock.c:653
      #13 thr_multi_lock (data=<optimized out>, count=<optimized out>, owner=<optimized out>, lock_wait_timeout=<optimized out>) at /data/src/11.2/mysys/thr_lock.c:1171
      #14 0x0000559b4c071445 in mysql_lock_tables (thd=thd@entry=0x7f3a1c000c68, sql_lock=sql_lock@entry=0x7f3a1c045dc8, flags=flags@entry=0) at /data/src/11.2/sql/lock.cc:352
      #15 0x0000559b4c071feb in mysql_lock_tables (thd=thd@entry=0x7f3a1c000c68, tables=0x7f3a1c045d58, count=2, flags=flags@entry=0) at /data/src/11.2/sql/lock.cc:304
      #16 0x0000559b4bc6f6f5 in lock_tables (thd=thd@entry=0x7f3a1c000c68, tables=0x7f3a1c010ce8, count=<optimized out>, flags=flags@entry=0) at /data/src/11.2/sql/sql_base.cc:5888
      #17 0x0000559b4bc7105a in open_and_lock_tables (thd=thd@entry=0x7f3a1c000c68, options=..., tables=<optimized out>, tables@entry=0x7f3a1c010ce8, derived=derived@entry=true, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x7f3a45cc8b90) at /data/src/11.2/sql/sql_base.cc:5626
      #18 0x0000559b4bcaa23d in open_and_lock_tables (flags=0, derived=true, tables=0x7f3a1c010ce8, thd=0x7f3a1c000c68) at /data/src/11.2/sql/sql_base.h:525
      #19 mysql_insert (thd=thd@entry=0x7f3a1c000c68, table_list=0x7f3a1c010ce8, fields=..., values_list=..., update_fields=..., update_values=..., duplic=<optimized out>, ignore=<optimized out>, result=<optimized out>) at /data/src/11.2/sql/sql_insert.cc:768
      #20 0x0000559b4bcdde50 in mysql_execute_command (thd=thd@entry=0x7f3a1c000c68, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/src/11.2/sql/sql_parse.cc:4460
      #21 0x0000559b4bce20d6 in mysql_parse (thd=0x7f3a1c000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /data/src/11.2/sql/sql_parse.cc:7810
      #22 0x0000559b4bce4dd5 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f3a1c000c68, packet=packet@entry=0x7f3a1c008849 "INSERT IGNORE INTO updateable_views_db.table_multipart ( field4 ) VALUES ( 15187 )", packet_length=packet_length@entry=82, blocking=blocking@entry=true) at /data/src/11.2/sql/sql_parse.cc:1990
      #23 0x0000559b4bce65d4 in do_command (thd=0x7f3a1c000c68, blocking=blocking@entry=true) at /data/src/11.2/sql/sql_parse.cc:1406
      #24 0x0000559b4be0d2d7 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x559b4e88b3c8, put_in_cache=put_in_cache@entry=true) at /data/src/11.2/sql/sql_connect.cc:1418
      #25 0x0000559b4be0d645 in handle_one_connection (arg=arg@entry=0x559b4e88b3c8) at /data/src/11.2/sql/sql_connect.cc:1320
      #26 0x0000559b4c194d20 in pfs_spawn_thread (arg=0x559b4e88b438) at /data/src/11.2/storage/perfschema/pfs.cc:2201
      #27 0x00007f3a5b8a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #28 0x00007f3a5b92861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.