Bug #79820 | Assertion `thd->mdl_context.owns_equal_or_stronger_lock( MDL_key::TABLESPACE, "" | ||
---|---|---|---|
Submitted: | 1 Jan 2016 22:14 | Modified: | 5 Oct 2017 18:44 |
Reporter: | Roel Van de Paar | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S6 (Debug Builds) |
Version: | 5.7.10, 5.7.11, 8.0.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | debug |
[1 Jan 2016 22:14]
Roel Van de Paar
[2 Jan 2016 3:52]
MySQL Verification Team
Hello Roel, Thank you for the report and test case. Observed that 5.7.10, 5.7.11 and 5.8.0 debug builds are affected. Thanks, Umesh
[1 Mar 2016 7:41]
Sivert Sørumgård
Posted by developer: ALTER TABLE ... TABLESPACE under LOCK TABLE will not acquire meta data lock on the new tablespace name. For schema handling in a similar setting, locks har acquired in Alter_table_ctx::is_database_changed(). We probably need a similar mechanism for tablespaces; alternatively, get_and_lock_tablespace_names() must be extended to also acquire locks when under LOCK TABLE.
[18 Jun 2016 21:35]
Omer Barnir
Posted by developer: Reported version value updated to reflect release name change from 5.8 to 8.0
[5 Oct 2017 18:44]
Paul DuBois
Posted by developer: Fixed in 8.0.4. Failure to acquire tablespace metadata locks for ALTER TABLE when a LOCK TABLES was active could cause an assertion to be raised.
[28 Jan 2020 18:09]
Tomislav Plavcic
Seems this is still reproducible in 5.7.29: Client: 5.7.29>CREATE TABLE t3(c5 int); Query OK, 0 rows affected (0.02 sec) 5.7.29>CREATE TABLE t2(c3 int,c4 int); Query OK, 0 rows affected (0.01 sec) 5.7.29>CREATE TABLE t1(c1 int,c2 int); Query OK, 0 rows affected (0.00 sec) 5.7.29>LOCK TABLE t1 WRITE,t2 WRITE,t3 WRITE; Query OK, 0 rows affected (0.01 sec) 5.7.29>ALTER TABLE t1 TABLESPACE ts STORAGE DISK ENGINE=InnoDB; ERROR 2013 (HY000): Lost connection to MySQL server during query Error log: 2020-01-28T18:05:48.741084Z 0 [Note] /home/tomislav.plavcic/build/mysql-5.7.29-linux-x86_64-debug/bin/mysqld: ready for connections. Version: '5.7.29-debug' socket: '/home/tomislav.plavcic/build/mysql-5.7.29-linux-x86_64-debug/socket.sock' port: 18895 MySQL Community Server (GPL) mysqld: /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/unireg.cc:270: bool mysql_create_frm(THD*, const char*, const char*, const char*, HA_CREATE_INFO*, List<Create_field>&, uint, KEY*, handler*): Assertion `thd->mdl_context.owns_equal_or_stronger_lock( MDL_key::TABLESPACE, "", create_info->tablespace, MDL_INTENTION_EXCLUSIVE)' failed. 18:05:54 UTC - mysqld got signal 6 ; GDB: (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 #1 0x0000560494a793b8 in my_write_core (sig=6) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/mysys/stacktrace.c:261 #2 0x000056049401938a in handle_fatal_signal (sig=6) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/signal_handler.cc:227 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #5 0x00007fe034462801 in __GI_abort () at abort.c:79 #6 0x00007fe03445239a in __assert_fail_base (fmt=0x7fe0345d97d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x560495230548 "thd->mdl_context.owns_equal_or_stronger_lock( MDL_key::TABLESPACE, \"\", create_info->tablespace, MDL_INTENTION_EXCLUSIVE)", file=file@entry=0x5604952304c8 "/home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/unireg.cc", line=line@entry=270, function=function@entry=0x560495230800 <mysql_create_frm(THD*, char const*, char const*, char const*, st_ha_create_information*, List<Create_field>&, unsigned int, st_key*, handler*)::__PRETTY_FUNCTION__> "bool mysql_create_frm(THD*, const char*, const char*, const char*, HA_CREATE_INFO*, List<Create_field>&, uint, KEY*, handler*)") at assert.c:92 #7 0x00007fe034452412 in __GI___assert_fail (assertion=0x560495230548 "thd->mdl_context.owns_equal_or_stronger_lock( MDL_key::TABLESPACE, \"\", create_info->tablespace, MDL_INTENTION_EXCLUSIVE)", file=0x5604952304c8 "/home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/unireg.cc", line=270, function=0x560495230800 <mysql_create_frm(THD*, char const*, char const*, char const*, st_ha_create_information*, List<Create_field>&, unsigned int, st_key*, handler*)::__PRETTY_FUNCTION__> "bool mysql_create_frm(THD*, const char*, const char*, const char*, HA_CREATE_INFO*, List<Create_field>&, uint, KEY*, handler*)") at assert.c:101 #8 0x0000560494824eb5 in mysql_create_frm (thd=0x7fe00b419000, file_name=0x7fe036b0aee0 "./test/#sql-4d91_4.frm", db=0x7fe00b427f90 "test", table=0x7fe036b0ccf0 "#sql-4d91_4", create_info=0x7fe036b0dd10, create_fields=..., keys=0, key_info=0x7fe00b428488, db_file=0x7fe00b428198) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/unireg.cc:267 #9 0x0000560494826072 in rea_create_table (thd=0x7fe00b419000, path=0x7fe036b0d544 "./test/#sql-4d91_4", db=0x7fe00b427f90 "test", table_name=0x7fe036b0ccf0 "#sql-4d91_4", create_info=0x7fe036b0dd10, create_fields=..., keys=0, key_info=0x7fe00b428488, file=0x7fe00b428198, no_ha_table=true) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/unireg.cc:548 #10 0x00005604947a3db0 in create_table_impl (thd=0x7fe00b419000, db=0x7fe00b427f90 "test", table_name=0x7fe036b0ccf0 "#sql-4d91_4", error_table_name=0x7fe00b4279d0 "t1", path=0x7fe036b0d544 "./test/#sql-4d91_4", create_info=0x7fe036b0dd10, alter_info=0x7fe036b0dc60, internal_tmp_table=true, select_field_count=0, no_ha_table=true, is_trans=0x0, key_info=0x7fe036b0c2b0, key_count=0x7fe036b0c284) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/sql_table.cc:5350 #11 0x00005604947add9f in mysql_alter_table (thd=0x7fe00b419000, new_db=0x7fe00b427f90 "test", new_name=0x0, create_info=0x7fe036b0dd10, table_list=0x7fe00b427a08, alter_info=0x7fe036b0dc60) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/sql_table.cc:9640 #12 0x0000560494938617 in Sql_cmd_alter_table::execute (this=0x7fe00b427fa8, thd=0x7fe00b419000) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/sql_alter.cc:333 #13 0x00005604947112e8 in mysql_execute_command (thd=0x7fe00b419000, first_level=true) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/sql_parse.cc:4845 #14 0x00005604947133f5 in mysql_parse (thd=0x7fe00b419000, parser_state=0x7fe036b0f4f0) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/sql_parse.cc:5584 #15 0x00005604947082f9 in dispatch_command (thd=0x7fe00b419000, com_data=0x7fe036b0fda0, command=COM_QUERY) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/sql_parse.cc:1491 #16 0x0000560494707183 in do_command (thd=0x7fe00b419000) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/sql_parse.cc:1032 #17 0x000056049484b074 in handle_connection (arg=0x7fe015efd500) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:313 #18 0x0000560494f46a60 in pfs_spawn_thread (arg=0x7fe01efd4220) at /home/tomislav.plavcic/build/tmp/mysql-server_dbg/storage/perfschema/pfs.cc:2197 #19 0x00007fe0351596db in start_thread (arg=0x7fe036b10700) at pthread_create.c:463 #20 0x00007fe03454388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95