[MDEV-10792] Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)' failed in mysql_rm_table_no_locks Created: 2016-09-11  Updated: 2016-11-22  Resolved: 2016-11-22

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Temporary, Locking
Affects Version/s: 10.2
Fix Version/s: 10.2.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nirbhay Choubey (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.2.4-3

 Description   

Stack trace from 10.2 54b81ac57f89c

mysqld: /data/src/10.2/sql/sql_table.cc:2359: int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool): Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)' failed.
160913  1:24:05 [ERROR] mysqld got signal 6 ;
 
#6  0x00007f1435e34266 in __assert_fail_base (fmt=0x7f1435f6d238 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f143901bc50 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)", file=file@entry=0x7f143901b1d8 "/data/src/10.2/sql/sql_table.cc", line=line@entry=2359, function=function@entry=0x7f143901d080 <mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool)::__PRETTY_FUNCTION__> "int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool)") at assert.c:92
#7  0x00007f1435e34312 in __GI___assert_fail (assertion=0x7f143901bc50 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)", file=0x7f143901b1d8 "/data/src/10.2/sql/sql_table.cc", line=2359, function=0x7f143901d080 <mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool)::__PRETTY_FUNCTION__> "int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool)") at assert.c:101
#8  0x00007f143876de6f in mysql_rm_table_no_locks (thd=0x7f142d016070, tables=0x7f142d064198, if_exists=false, drop_temporary=false, drop_view=false, dont_log_query=false, dont_free_locks=false) at /data/src/10.2/sql/sql_table.cc:2357
#9  0x00007f143876d5c9 in mysql_rm_table (thd=0x7f142d016070, tables=0x7f142d064198, if_exists=0 '\000', drop_temporary=0 '\000') at /data/src/10.2/sql/sql_table.cc:2090
#10 0x00007f14386bb55a in mysql_execute_command (thd=0x7f142d016070) at /data/src/10.2/sql/sql_parse.cc:4639
#11 0x00007f14386c518b in mysql_parse (thd=0x7f142d016070, rawbuf=0x7f142d064088 "DROP TABLE nonexisting_table, t1", length=32, parser_state=0x7f1439614dd0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7774
#12 0x00007f14386b3579 in dispatch_command (command=COM_QUERY, thd=0x7f142d016070, packet=0x7f142d058071 "DROP TABLE nonexisting_table, t1", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1805
#13 0x00007f14386b1faa in do_command (thd=0x7f142d016070) at /data/src/10.2/sql/sql_parse.cc:1365
#14 0x00007f14387ed936 in do_handle_one_connection (connect=0x7f143546d410) at /data/src/10.2/sql/sql_connect.cc:1354
#15 0x00007f14387ed6c3 in handle_one_connection (arg=0x7f143546d410) at /data/src/10.2/sql/sql_connect.cc:1260
#16 0x00007f1438afbef2 in pfs_spawn_thread (arg=0x7f14354519f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#17 0x00007f1437d360a4 in start_thread (arg=0x7f1439616300) at pthread_create.c:309
#18 0x00007f1435eee87d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

CREATE TEMPORARY TABLE t1 (i INT);
--error ER_BAD_TABLE_ERROR
DROP TABLE nonexisting_table, t1;

The problem apparently appeared in 10.2 tree with this revision:

commit 7305be2f7e724e5e62961606794beab199d79045
Author: Nirbhay Choubey <nirbhay@mariadb.com>
Date:   Fri Jun 10 16:19:59 2016 -0400
 
    MDEV-5535: Cannot reopen temporary table
    
    mysqld maintains a list of TABLE objects for all temporary
    tables created within a session in THD. Here each table is
    represented by a TABLE object.
    
    A query referencing a particular temporary table for more
    than once, however, failed with ER_CANT_REOPEN_TABLE error
    because a TABLE_SHARE was allocate together with the TABLE,
    so temporary tables always had only one TABLE per TABLE_SHARE.
    
    This patch lift this restriction by separating TABLE and
    TABLE_SHARE objects and storing TABLE_SHAREs for temporary
    tables in a list in THD, and TABLEs in a list within their
    respective TABLE_SHAREs.


Generated at Thu Feb 08 07:44:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.