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

Assertion `(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)' failed in mysql_create_like_table

Details

    Description

      CREATE TABLE t1 (a INT);
      CREATE TABLE t2 (b INT);
      CREATE VIEW v2 AS SELECT * FROM t2 ;
       
      LOCK TABLES t1 WRITE, v2 WRITE;
      CREATE TABLE IF NOT EXISTS t1 LIKE t2;
       
      # Cleanup
      UNLOCK TABLES;
      DROP VIEW v2;
      DROP TABLE t1, t2;
      

      10.4 a2e477ff

      mysqld: /data/src/10.4/sql/sql_table.cc:5723: bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*): Assertion `(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)' failed.
      190406 13:33:08 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fd201d73ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000562bc1f80412 in mysql_create_like_table (thd=0x7fd1e0000b00, table=0x7fd1e00156e0, src_table=0x7fd1e0015dc8, create_info=0x7fd1fc6ed910) at /data/src/10.4/sql/sql_table.cc:5720
      #9  0x0000562bc1ea3d66 in mysql_execute_command (thd=0x7fd1e0000b00) at /data/src/10.4/sql/sql_parse.cc:4376
      #10 0x0000562bc1eb1171 in mysql_parse (thd=0x7fd1e0000b00, rawbuf=0x7fd1e00155e8 "CREATE TABLE IF NOT EXISTS t1 LIKE t2", length=37, parser_state=0x7fd1fc6ee180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #11 0x0000562bc1e9cbc8 in dispatch_command (command=COM_QUERY, thd=0x7fd1e0000b00, packet=0x7fd1e000a8a1 "CREATE TABLE IF NOT EXISTS t1 LIKE t2", packet_length=37, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #12 0x0000562bc1e9b3ae in do_command (thd=0x7fd1e0000b00) at /data/src/10.4/sql/sql_parse.cc:1365
      #13 0x0000562bc20137a5 in do_handle_one_connection (connect=0x562bc5aab520) at /data/src/10.4/sql/sql_connect.cc:1398
      #14 0x0000562bc2013516 in handle_one_connection (arg=0x562bc5aab520) at /data/src/10.4/sql/sql_connect.cc:1301
      #15 0x0000562bc2507995 in pfs_spawn_thread (arg=0x562bc5b9d8f0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #16 0x00007fd203c62494 in start_thread (arg=0x7fd1fc6ef700) at pthread_create.c:333
      #17 0x00007fd201e3093f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Slightly different on 10.1-10.2:

      10.2 b4a7bde76

      mysqld: /data/src/10.2/sql/sql_table.cc:5516: bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*): Assertion `(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_EXCLUSIVE)' failed.
      190406 13:35:10 [ERROR] mysqld got signal 6 ;
      

      Yet slightly different on 5.5:

      5.5 370886a9

      mysqld: /data/src/5.5/sql/sql_table.cc:4887: bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, HA_CREATE_INFO*): Assertion `(create_info->options & 1) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_EXCLUSIVE)' failed.
      

      No obvious problem on a non-debug build.

      Attachments

        Activity

          Ran into this one also. Similar testcase

          USE test;
          CREATE TABLE t1 (c INT);
          CREATE TABLE t2 (c INT);
          LOCK TABLES t1 WRITE,t2 WRITE;
          CREATE TABLE IF NOT EXISTS t1 LIKE t2;
          

          Leads to:

          10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug)

          mysqld: /test/10.4_dbg/sql/sql_table.cc:5781: bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*): Assertion `(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)' failed.
          

          10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug)

          Core was generated by `/test/MD110820-mariadb-10.4.15-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 0x14a83ee5b700 (LWP 3970272))]
          (gdb) bt
          #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
          #1  0x000055b7470998a6 in my_write_core (sig=sig@entry=6) at /test/10.4_dbg/mysys/stacktrace.c:482
          #2  0x000055b746815cdc in handle_fatal_signal (sig=6) at /test/10.4_dbg/sql/signal_handler.cc:343
          #3  <signal handler called>
          #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
          #5  0x000014a83d0f28b1 in __GI_abort () at abort.c:79
          #6  0x000014a83d0e242a in __assert_fail_base (fmt=0x14a83d269a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55b7471a8f18 "(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)", file=file@entry=0x55b7471a8028 "/test/10.4_dbg/sql/sql_table.cc", line=line@entry=5781, function=function@entry=0x55b7471aa7c0 <mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)::__PRETTY_FUNCTION__> "bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)") at assert.c:92
          #7  0x000014a83d0e24a2 in __GI___assert_fail (assertion=assertion@entry=0x55b7471a8f18 "(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)", file=file@entry=0x55b7471a8028 "/test/10.4_dbg/sql/sql_table.cc", line=line@entry=5781, function=function@entry=0x55b7471aa7c0 <mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)::__PRETTY_FUNCTION__> "bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)") at assert.c:101
          #8  0x000055b746627575 in mysql_create_like_table (thd=thd@entry=0x14a816c15070, table=table@entry=0x14a816c6d198, src_table=src_table@entry=0x14a816c6d898, create_info=create_info@entry=0x14a83ee58010) at /test/10.4_dbg/sql/sql_table.cc:5778
          #9  0x000055b74662824b in Sql_cmd_create_table_like::execute (this=0x14a816c6d138, thd=0x14a816c15070) at /test/10.4_dbg/sql/sql_table.cc:11469
          #10 0x000055b74656aa3d in mysql_execute_command (thd=thd@entry=0x14a816c15070) at /test/10.4_dbg/sql/sql_parse.cc:6098
          #11 0x000055b74656d090 in mysql_parse (thd=thd@entry=0x14a816c15070, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14a83ee5a460, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7896
          #12 0x000055b74656f920 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a816c15070, packet=packet@entry=0x14a816c57071 "CREATE TABLE IF NOT EXISTS t1 LIKE t2", packet_length=packet_length@entry=37, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:1834
          #13 0x000055b74657335b in do_command (thd=0x14a816c15070) at /test/10.4_dbg/sql/sql_parse.cc:1352
          #14 0x000055b74669f8b6 in do_handle_one_connection (connect=connect@entry=0x14a83bc35790) at /test/10.4_dbg/sql/sql_connect.cc:1412
          #15 0x000055b74669f9d6 in handle_one_connection (arg=0x14a83bc35790) at /test/10.4_dbg/sql/sql_connect.cc:1316
          #16 0x000014a83e0596db in start_thread (arg=0x14a83ee5b700) at pthread_create.c:463
          #17 0x000014a83d1d3a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
          

          Bug confirmed present in:
          MariaDB: 10.1.47 (dbg), 10.2.34 (dbg), 10.3.25 (dbg), 10.4.15 (dbg), 10.5.6 (dbg)
          MySQL: 5.5.62 (dbg)

          Bug confirmed not present in:
          MariaDB: 10.1.47 (opt), 10.2.34 (opt), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (opt)
          MySQL: 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)

          Roel Roel Van de Paar added a comment - Ran into this one also. Similar testcase USE test; CREATE TABLE t1 (c INT); CREATE TABLE t2 (c INT); LOCK TABLES t1 WRITE,t2 WRITE; CREATE TABLE IF NOT EXISTS t1 LIKE t2; Leads to: 10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug) mysqld: /test/10.4_dbg/sql/sql_table.cc:5781: bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*): Assertion `(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)' failed. 10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug) Core was generated by `/test/MD110820-mariadb-10.4.15-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 0x14a83ee5b700 (LWP 3970272))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 #1 0x000055b7470998a6 in my_write_core (sig=sig@entry=6) at /test/10.4_dbg/mysys/stacktrace.c:482 #2 0x000055b746815cdc in handle_fatal_signal (sig=6) at /test/10.4_dbg/sql/signal_handler.cc:343 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #5 0x000014a83d0f28b1 in __GI_abort () at abort.c:79 #6 0x000014a83d0e242a in __assert_fail_base (fmt=0x14a83d269a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55b7471a8f18 "(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)", file=file@entry=0x55b7471a8028 "/test/10.4_dbg/sql/sql_table.cc", line=line@entry=5781, function=function@entry=0x55b7471aa7c0 <mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)::__PRETTY_FUNCTION__> "bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)") at assert.c:92 #7 0x000014a83d0e24a2 in __GI___assert_fail (assertion=assertion@entry=0x55b7471a8f18 "(create_info->tmp_table()) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_EXCLUSIVE)", file=file@entry=0x55b7471a8028 "/test/10.4_dbg/sql/sql_table.cc", line=line@entry=5781, function=function@entry=0x55b7471aa7c0 <mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)::__PRETTY_FUNCTION__> "bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*)") at assert.c:101 #8 0x000055b746627575 in mysql_create_like_table (thd=thd@entry=0x14a816c15070, table=table@entry=0x14a816c6d198, src_table=src_table@entry=0x14a816c6d898, create_info=create_info@entry=0x14a83ee58010) at /test/10.4_dbg/sql/sql_table.cc:5778 #9 0x000055b74662824b in Sql_cmd_create_table_like::execute (this=0x14a816c6d138, thd=0x14a816c15070) at /test/10.4_dbg/sql/sql_table.cc:11469 #10 0x000055b74656aa3d in mysql_execute_command (thd=thd@entry=0x14a816c15070) at /test/10.4_dbg/sql/sql_parse.cc:6098 #11 0x000055b74656d090 in mysql_parse (thd=thd@entry=0x14a816c15070, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14a83ee5a460, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7896 #12 0x000055b74656f920 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a816c15070, packet=packet@entry=0x14a816c57071 "CREATE TABLE IF NOT EXISTS t1 LIKE t2", packet_length=packet_length@entry=37, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:1834 #13 0x000055b74657335b in do_command (thd=0x14a816c15070) at /test/10.4_dbg/sql/sql_parse.cc:1352 #14 0x000055b74669f8b6 in do_handle_one_connection (connect=connect@entry=0x14a83bc35790) at /test/10.4_dbg/sql/sql_connect.cc:1412 #15 0x000055b74669f9d6 in handle_one_connection (arg=0x14a83bc35790) at /test/10.4_dbg/sql/sql_connect.cc:1316 #16 0x000014a83e0596db in start_thread (arg=0x14a83ee5b700) at pthread_create.c:463 #17 0x000014a83d1d3a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Bug confirmed present in: MariaDB: 10.1.47 (dbg), 10.2.34 (dbg), 10.3.25 (dbg), 10.4.15 (dbg), 10.5.6 (dbg) MySQL: 5.5.62 (dbg) Bug confirmed not present in: MariaDB: 10.1.47 (opt), 10.2.34 (opt), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (opt) MySQL: 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)

          Made a simpler fix in 10.6 for this bug.

          monty Michael Widenius added a comment - Made a simpler fix in 10.6 for this bug.

          People

            wlad Vladislav Vaintroub
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.