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

Assertion `table_list->prelocking_placeholder == TABLE_LIST::PRELOCK_NONE' failed in check_lock_and_start_stmt on CREATE OR REPLACE TABLE

    XMLWordPrintable

    Details

      Description

      USE test;
      CREATE FUNCTION f(z INT) RETURNS INT READS SQL DATA RETURN (SELECT * FROM t);
      CREATE TABLE t(a INT) ENGINE=InnoDB;
      CREATE TEMPORARY TABLE t(c INT);
      CREATE OR REPLACE TABLE t AS SELECT f();
      

      Leads to:

      10.5.5 054f10365c49b70a3868edc0c955ffe187f8344c (Debug)

      mysqld: /test/10.5_dbg/sql/sql_base.cc:4908: bool check_lock_and_start_stmt(THD*, Query_tables_list*, TABLE_LIST*): Assertion `table_list->prelocking_placeholder == TABLE_LIST::PRELOCK_NONE' failed.
      

      10.5.5 054f10365c49b70a3868edc0c955ffe187f8344c (Debug)

      Core was generated by `/test/MD200720-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x14f8d4d14700 (LWP 654806))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000559cdd3bd82d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000559cdcb7775c in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x000014f8d2faa8b1 in __GI_abort () at abort.c:79
      #6  0x000014f8d2f9a42a in __assert_fail_base (fmt=0x14f8d3121a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x559cdd528340 "table_list->prelocking_placeholder == TABLE_LIST::PRELOCK_NONE", file=file@entry=0x559cdd5278f0 "/test/10.5_dbg/sql/sql_base.cc", line=line@entry=4908, function=function@entry=0x559cdd52a920 <check_lock_and_start_stmt(THD*, Query_tables_list*, TABLE_LIST*)::__PRETTY_FUNCTION__> "bool check_lock_and_start_stmt(THD*, Query_tables_list*, TABLE_LIST*)") at assert.c:92
      #7  0x000014f8d2f9a4a2 in __GI___assert_fail (assertion=assertion@entry=0x559cdd528340 "table_list->prelocking_placeholder == TABLE_LIST::PRELOCK_NONE", file=file@entry=0x559cdd5278f0 "/test/10.5_dbg/sql/sql_base.cc", line=line@entry=4908, function=function@entry=0x559cdd52a920 <check_lock_and_start_stmt(THD*, Query_tables_list*, TABLE_LIST*)::__PRETTY_FUNCTION__> "bool check_lock_and_start_stmt(THD*, Query_tables_list*, TABLE_LIST*)") at assert.c:101
      #8  0x0000559cdc848be6 in check_lock_and_start_stmt (thd=thd@entry=0x14f8b0c15088, prelocking_ctx=0x14f8b0c18fe0, table_list=table_list@entry=0x14f8b0c76668) at /test/10.5_dbg/sql/sql_base.cc:4908
      #9  0x0000559cdc84b157 in restart_trans_for_tables (thd=thd@entry=0x14f8b0c15088, table=0x14f8b0c76668) at /test/10.5_dbg/sql/sql_base.cc:5576
      #10 0x0000559cdc99c1ea in create_table_impl (thd=thd@entry=0x14f8b0c15088, orig_db=@0x14f8b0c741c8: {str = 0x14f8b0c74880 "test", length = 4}, orig_table_name=@0x14f8b0c741d8: {str = 0x14f8b0c74178 "t", length = 1}, db=@0x14f8b0c741c8: {str = 0x14f8b0c74880 "test", length = 4}, table_name=@0x14f8b0c741d8: {str = 0x14f8b0c74178 "t", length = 1}, path=path@entry=0x14f8d4d11740 "./test/t", options={m_options = DDL_options_st::OPT_OR_REPLACE}, create_info=0x14f8d4d128f0, alter_info=0x14f8d4d12820, create_table_mode=1, is_trans=0x0, key_info=0x14f8d4d11728, key_count=0x14f8d4d11724, frm=0x14f8d4d11730) at /test/10.5_dbg/sql/sql_table.cc:5204
      #11 0x0000559cdc99cbd3 in mysql_create_table_no_lock (thd=thd@entry=0x14f8b0c15088, db=0x14f8b0c741c8, table_name=0x14f8b0c741d8, create_info=0x14f8d4d128f0, alter_info=0x14f8d4d12820, is_trans=is_trans@entry=0x0, create_table_mode=1, table_list=0x14f8b0c741b0) at /test/10.5_dbg/sql/sql_table.cc:5374
      #12 0x0000559cdc89037a in select_create::create_table_from_items (this=this@entry=0x14f8b0c76d80, thd=0x14f8b0c15088, items=items@entry=0x14f8d4d12420, lock=lock@entry=0x14f8d4d12418, hooks=hooks@entry=0x14f8d4d12460) at /test/10.5_dbg/sql/sql_insert.cc:4456
      #13 0x0000559cdc8908c8 in select_create::prepare (this=0x14f8b0c76d80, _values=<optimized out>, u=<optimized out>) at /test/10.5_dbg/sql/sql_insert.cc:4653
      #14 0x0000559cdc93cb70 in JOIN::prepare (this=this@entry=0x14f8b0c76e80, tables_init=tables_init@entry=0x0, conds_init=conds_init@entry=0x0, og_num=og_num@entry=0, order_init=order_init@entry=0x0, skip_order_by=skip_order_by@entry=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x14f8b0c74888, unit_arg=0x14f8b0c190a0) at /test/10.5_dbg/sql/sql_select.cc:1494
      #15 0x0000559cdc948fd2 in mysql_select (thd=thd@entry=0x14f8b0c15088, tables=0x0, fields=@0x14f8b0c749d8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14f8b0c75a18, last = 0x14f8b0c75a18, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2201171004160, result=0x14f8b0c76d80, unit=0x14f8b0c190a0, select_lex=0x14f8b0c74888) at /test/10.5_dbg/sql/sql_select.cc:4620
      #16 0x0000559cdc9493d4 in handle_select (thd=thd@entry=0x14f8b0c15088, lex=lex@entry=0x14f8b0c18fd8, result=result@entry=0x14f8b0c76d80, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #17 0x0000559cdc99e6ca in Sql_cmd_create_table_like::execute (this=0x14f8b0c74150, thd=0x14f8b0c15088) at /test/10.5_dbg/sql/sql_table.cc:11957
      #18 0x0000559cdc8d0282 in mysql_execute_command (thd=thd@entry=0x14f8b0c15088) at /test/10.5_dbg/sql/sql_parse.cc:5951
      #19 0x0000559cdc8d7b8a in mysql_parse (thd=thd@entry=0x14f8b0c15088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14f8d4d13350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993
      #20 0x0000559cdc8c463c in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14f8b0c15088, packet=packet@entry=0x14f8b0c67089 "CREATE OR REPLACE TABLE t AS SELECT f()", packet_length=packet_length@entry=39, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1866
      #21 0x0000559cdc8c2e16 in do_command (thd=0x14f8b0c15088) at /test/10.5_dbg/sql/sql_parse.cc:1347
      #22 0x0000559cdca1f4af in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14f8b40c9808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #23 0x0000559cdca1fbcb in handle_one_connection (arg=arg@entry=0x14f8b40c9808) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #24 0x0000559cdce83dca in pfs_spawn_thread (arg=0x14f8d1846508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #25 0x000014f8d3c8d6db in start_thread (arg=0x14f8d4d14700) at pthread_create.c:463
      #26 0x000014f8d308ba3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.1.46 (dbg), 10.2.33 (dbg), 10.3.24 (dbg), 10.4.14 (dbg), 10.5.5 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.46 (opt), 10.2.33 (opt), 10.3.24 (opt), 10.4.14 (opt), 10.5.5 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: