Bug #81451 thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL
Submitted: 17 May 2016 5:44 Modified: 17 May 2016 6:56
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:5.5.49 OS:Any
Assigned to: CPU Architecture:Any

[17 May 2016 5:44] Roel Van de Paar
Description:
Version: '5.5.49-debug'  socket: '/sda/mysql-5.5.49-linux-x86_64-debug/socket.sock'  port: 19744  MySQL Community Server (GPL)
mysqld: /git/mysql-server/sql/sql_table.cc:4705: 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.

+bt
#0  0x00007fdcc6cea741 in __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x00000000007de0c8 in my_write_core (sig=6) at /git/mysql-server/mysys/stacktrace.c:433
#2  0x00000000006a1088 in handle_fatal_signal (sig=6) at /git/mysql-server/sql/signal_handler.cc:247
#3  <signal handler called>
#4  0x00007fdcc5d0b5f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fdcc5d0cce8 in __GI_abort () at abort.c:90
#6  0x00007fdcc5d04566 in __assert_fail_base (fmt=0x7fdcc5e54228 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0xa92a08 "(create_info->options & 1) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_EXCLUSIVE)", file=file@entry=0xa922b0 "/git/mysql-server/sql/sql_table.cc", line=line@entry=4705, function=function@entry=0xa93180 <mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, st_ha_create_information*)::__PRETTY_FUNCTION__> "bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, HA_CREATE_INFO*)") at assert.c:92
#7  0x00007fdcc5d04612 in __GI___assert_fail (assertion=0xa92a08 "(create_info->options & 1) || thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_EXCLUSIVE)", file=0xa922b0 "/git/mysql-server/sql/sql_table.cc", line=4705, function=0xa93180 <mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, st_ha_create_information*)::__PRETTY_FUNCTION__> "bool mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, HA_CREATE_INFO*)") at assert.c:101
#8  0x00000000005f67c2 in mysql_create_like_table (thd=thd@entry=0x7fdc31da8000, table=table@entry=0x7fdc2d025110, src_table=src_table@entry=0x7fdc2d025678, create_info=create_info@entry=0x7fdcc72faeb0) at /git/mysql-server/sql/sql_table.cc:4702
#9  0x000000000058a6b4 in mysql_execute_command (thd=thd@entry=0x7fdc31da8000) at /git/mysql-server/sql/sql_parse.cc:2578
#10 0x0000000000590ff6 in mysql_parse (thd=thd@entry=0x7fdc31da8000, rawbuf=<optimized out>, length=37, parser_state=parser_state@entry=0x7fdcc72fb680) at /git/mysql-server/sql/sql_parse.cc:5780
#11 0x0000000000592843 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fdc31da8000, packet=packet@entry=0x7fdc31d9a901 "create table if not exists t1 like t2", packet_length=packet_length@entry=37) at /git/mysql-server/sql/sql_parse.cc:1038
#12 0x00000000005946cc in do_command (thd=0x7fdc31da8000) at /git/mysql-server/sql/sql_parse.cc:773
#13 0x000000000063c978 in do_handle_one_connection (thd_arg=thd_arg@entry=0x7fdc31da8000) at /git/mysql-server/sql/sql_connect.cc:862
#14 0x000000000063ca35 in handle_one_connection (arg=0x7fdc31da8000) at /git/mysql-server/sql/sql_connect.cc:781
#15 0x00007fdcc6ce5dc5 in start_thread (arg=0x7fdcc72fc700) at pthread_create.c:308
#16 0x00007fdcc5dcc21d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
create table t2(c int)ENGINE=InnoDB;
create table t3(a int,b int,KEY (a))ENGINE=InnoDB;
CREATE TABLE t1(c1 INT UNSIGNED,c2 INT);
LOCK TABLE t1 WRITE,t2 WRITE,t3 WRITE;
create table if not exists t1 like t2;
[17 May 2016 6:56] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that 5.5.49(also, 5.5.51 daily build) debug build is
affected.

Thanks,
Umesh
[17 May 2016 6:56] MySQL Verification Team
I'm not able to repeat this issue on 5.6.30/5.7.12 release/debug builds
with the provided test case.