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

Assertion `t->s->tmp_table || thd->mdl_context.is_lock_owner(MDL_key::TABLE, t->s->db.str, t->s->table_name.str, t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? MDL_SHARED_WRITE : MDL_SHARED_READ)' failed.

    XMLWordPrintable

    Details

      Description

      USE test;
      CREATE TABLE t2(i int) ENGINE=MyISAM;
      CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Merge UNION=(t2);
      CREATE TEMPORARY TABLE t1 SELECT * FROM t1;
      

      Leads to:

      10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b (Debug)

      mysqld: /test/10.5_dbg/sql/lock.cc:174: int lock_tables_check(THD*, TABLE**, uint, uint): Assertion `t->s->tmp_table || thd->mdl_context.is_lock_owner(MDL_key::TABLE, t->s->db.str, t->s->table_name.str, t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? MDL_SHARED_WRITE : MDL_SHARED_READ)' failed.
      

      10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b (Debug)

      Core was generated by `/test/MD140720-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 0x14752470e700 (LWP 1884811))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000055d12c8884d7 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x000055d12c0429ba 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  0x00001475229a48b1 in __GI_abort () at abort.c:79
      #6  0x000014752299442a in __assert_fail_base (fmt=0x147522b1ba38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55d12cbc87c8 "t->s->tmp_table || thd->mdl_context.is_lock_owner(MDL_key::TABLE, t->s->db.str, t->s->table_name.str, t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? MDL_SHARED_WRITE : MDL_SHARED_READ)", file=file@entry=0x55d12cbc847b "/test/10.5_dbg/sql/lock.cc", line=line@entry=174, function=function@entry=0x55d12cbc8ce0 <lock_tables_check(THD*, TABLE**, unsigned int, unsigned int)::__PRETTY_FUNCTION__> "int lock_tables_check(THD*, TABLE**, uint, uint)") at assert.c:92
      #7  0x00001475229944a2 in __GI___assert_fail (assertion=assertion@entry=0x55d12cbc87c8 "t->s->tmp_table || thd->mdl_context.is_lock_owner(MDL_key::TABLE, t->s->db.str, t->s->table_name.str, t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? MDL_SHARED_WRITE : MDL_SHARED_READ)", file=file@entry=0x55d12cbc847b "/test/10.5_dbg/sql/lock.cc", line=line@entry=174, function=function@entry=0x55d12cbc8ce0 <lock_tables_check(THD*, TABLE**, unsigned int, unsigned int)::__PRETTY_FUNCTION__> "int lock_tables_check(THD*, TABLE**, uint, uint)") at assert.c:101
      #8  0x000055d12c18e7c6 in lock_tables_check (flags=0, count=4, tables=0x147500476b58, thd=0x147500415088) at /test/10.5_dbg/sql/lock.cc:170
      #9  mysql_lock_tables (thd=thd@entry=0x147500415088, tables=tables@entry=0x147500476b58, count=count@entry=4, flags=flags@entry=0) at /test/10.5_dbg/sql/lock.cc:291
      #10 0x000055d12bd1667e in lock_tables (thd=thd@entry=0x147500415088, tables=0x1475004741c0, count=<optimized out>, flags=flags@entry=0) at /test/10.5_dbg/sql/sql_base.cc:5449
      #11 0x000055d12bd18c29 in open_and_lock_tables (thd=thd@entry=0x147500415088, options=@0x14752470cb00: {m_options = DDL_options_st::OPT_NONE}, tables=<optimized out>, derived=derived@entry=true, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x14752470c7b8) at /test/10.5_dbg/sql/sql_base.cc:5169
      #12 0x000055d12be69e20 in open_and_lock_tables (flags=0, derived=true, tables=<optimized out>, options=@0x14752470cb00: {m_options = DDL_options_st::OPT_NONE}, thd=0x147500415088) at /test/10.5_dbg/sql/sql_base.h:500
      #13 Sql_cmd_create_table_like::execute (this=0x147500474160, thd=0x147500415088) at /test/10.5_dbg/sql/sql_table.cc:11906
      #14 0x000055d12bd9be4a in mysql_execute_command (thd=thd@entry=0x147500415088) at /test/10.5_dbg/sql/sql_parse.cc:5951
      #15 0x000055d12bda3752 in mysql_parse (thd=thd@entry=0x147500415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14752470d350, 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
      #16 0x000055d12bd90204 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x147500415088, packet=packet@entry=0x147500467089 "CREATE TEMPORARY TABLE t1 SELECT * FROM t1", packet_length=packet_length@entry=42, 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
      #17 0x000055d12bd8e9de in do_command (thd=0x147500415088) at /test/10.5_dbg/sql/sql_parse.cc:1347
      #18 0x000055d12beeac3b in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1475038c73a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #19 0x000055d12beeb357 in handle_one_connection (arg=arg@entry=0x1475038c73a8) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #20 0x000055d12c34eca8 in pfs_spawn_thread (arg=0x147521446508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #21 0x00001475236876db in start_thread (arg=0x14752470e700) at pthread_create.c:463
      #22 0x0000147522a85a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

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

      Bug confirmed not present in:
      MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 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:
            wlad Vladislav Vaintroub
            Reporter:
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: