[MDEV-10216] Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in myisam/mi_open.c:67: test_if_reopen Created: 2016-06-12  Updated: 2016-08-09  Resolved: 2016-08-09

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

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

Issue Links:
Relates
relates to MDEV-5535 cannot reopen temporary table Closed
Sprint: 10.2.2-1

 Description   

CREATE TABLE t (i INT) ENGINE=MyISAM;
CREATE TEMPORARY TABLE tmp LIKE t;
ALTER TABLE tmp RENAME TO t;
 
SELECT ( SELECT 1 FROM t a1, t a2 ) AS f1, ( SELECT 2 FROM t a3 ) AS f2 FROM DUAL;

Stack trace from 10.2 commit b2ae32aafdd2787ad456f38833f630182ded25e8

mysqld: /src/10.2/storage/myisam/mi_open.c:67: test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed.
160613  0:57:09 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f669b9e01d2 in __assert_fail () from /lib64/libc.so.6
#8  0x00005628ab8c546d in test_if_reopen (filename=0x7f669dcac800 "/bld/10.2/mysql-test/var/tmp/mysqld.1/#sql3f1e_3_1.MYI") at /src/10.2/storage/myisam/mi_open.c:66
#9  0x00005628ab8c5669 in mi_open (name=0x7f669219e158 "/bld/10.2/mysql-test/var/tmp/mysqld.1/#sql3f1e_3_1", mode=2, open_flags=82) at /src/10.2/storage/myisam/mi_open.c:117
#10 0x00005628ab899a75 in ha_myisam::open (this=0x7f6691e24088, name=0x7f669219e158 "/bld/10.2/mysql-test/var/tmp/mysqld.1/#sql3f1e_3_1", mode=2, test_if_locked=18) at /src/10.2/storage/myisam/ha_myisam.cc:754
#11 0x00005628ab3446d6 in handler::ha_open (this=0x7f6691e24088, table_arg=0x7f6691e3b470, name=0x7f669219e158 "/bld/10.2/mysql-test/var/tmp/mysqld.1/#sql3f1e_3_1", mode=2, test_if_locked=18) at /src/10.2/sql/handler.cc:2497
#12 0x00005628ab1e4fe5 in open_table_from_share (thd=0x7f669202d630, share=0x7f669219dc70, alias=0x7f6692068aa0 "t", db_stat=7, prgflag=44, ha_open_flags=18, outparam=0x7f6691e3b470, is_create_table=false) at /src/10.2/sql/table.cc:2946
#13 0x00005628ab2c6ecf in THD::open_temporary_table (this=0x7f669202d630, share=0x7f669219dc70, alias=0x7f6692068aa0 "t", open_in_engine=true) at /src/10.2/sql/temporary_tables.cc:1120
#14 0x00005628ab2c5998 in THD::open_temporary_table (this=0x7f669202d630, tl=0x7f6692068ae8) at /src/10.2/sql/temporary_tables.cc:367
#15 0x00005628ab2c5be5 in THD::open_temporary_tables (this=0x7f669202d630, tl=0x7f6692068490) at /src/10.2/sql/temporary_tables.cc:455
#16 0x00005628ab0f49cc in mysql_execute_command (thd=0x7f669202d630) at /src/10.2/sql/sql_parse.cc:3270
#17 0x00005628ab102708 in mysql_parse (thd=0x7f669202d630, rawbuf=0x7f66920677c8 "SELECT ( SELECT 1 FROM t a1, t a2 ) AS f1, ( SELECT 2 FROM t a3 ) AS f2 FROM DUAL", length=81, parser_state=0x7f669dcae9e0, is_com_multi=false, is_next_command=false) at /src/10.2/sql/sql_parse.cc:7729
#18 0x00005628ab0f0b51 in dispatch_command (command=COM_QUERY, thd=0x7f669202d630, packet=0x7f669205b271 "SELECT ( SELECT 1 FROM t a1, t a2 ) AS f1, ( SELECT 2 FROM t a3 ) AS f2 FROM DUAL", packet_length=81, is_com_multi=false, is_next_command=false) at /src/10.2/sql/sql_parse.cc:1792
#19 0x00005628ab0ef590 in do_command (thd=0x7f669202d630) at /src/10.2/sql/sql_parse.cc:1353
#20 0x00005628ab225d31 in do_handle_one_connection (connect=0x7f669b484310) at /src/10.2/sql/sql_connect.cc:1358
#21 0x00005628ab225abe in handle_one_connection (arg=0x7f669b484310) at /src/10.2/sql/sql_connect.cc:1264
#22 0x00005628ab93e728 in pfs_spawn_thread (arg=0x7f66969c6ff0) at /src/10.2/storage/perfschema/pfs.cc:1862
#23 0x00007f669d9290a4 in start_thread () from /lib64/libpthread.so.0
#24 0x00007f669ba9704d in clone () from /lib64/libc.so.6



 Comments   
Comment by Nirbhay Choubey (Inactive) [ 2016-06-15 ]

svoj Could you please review this patch?

http://lists.askmonty.org/pipermail/commits/2016-June/009452.html

Comment by Michael Widenius [ 2016-06-21 ]

This related issue with ALTER TABLE ... RENAME also fails:

create temporary table t1 (a int) engine=aria;
alter table t1 rename to t2;
SELECT ( SELECT 1 FROM t2 a1, t2 a2 ) AS f1, ( SELECT 2 FROM t2 a3 ) AS f2 FROM DUAL;
drop table t1,t2;

This fails in 10.2 with this assert:
#4 0x000000000075317e in mysql_rm_table_no_locks (thd=0x7fffd0018008, tables=0x7fffd0068620, if_exists=false, drop_temporary=false, drop_view=false, dont_log_query=false, dont_free_locks=false) at /my/maria-10.2/sql/sql_table.cc:2354

DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
table->table_name,
MDL_SHARED));

As temporary tables are created with random internally names, any rename of these should not try to rename the table in the handler but instead just alter the name in the TABLE object, to make the sql level see the new name.

Comment by Nirbhay Choubey (Inactive) [ 2016-06-21 ]

http://lists.askmonty.org/pipermail/commits/2016-June/009477.html

Comment by Nirbhay Choubey (Inactive) [ 2016-08-09 ]

Approved by Monty on IRC.

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