Skip to content

Commit d57ddaa

Browse files
committed
MDEV-15551 Server hangs or assertion `strcmp(share->unique_file_name,filename) || share->last_version' fails in test_if_reopen or unexpected ER_LOCK_DEADLOCK
only use HA_EXTRA_PREPARE_FOR_DROP when the table is going to be dropped
1 parent 5c744bb commit d57ddaa

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
create table t1 (i int) engine=myisam partition by hash(i) partitions 2 ;
2+
lock table t1 write;
3+
truncate table t1;
4+
desc t1;
5+
Field Type Null Key Default Extra
6+
i int(11) YES NULL
7+
drop table t1;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# MDEV-15551 Server hangs or assertion `strcmp(share->unique_file_name,filename) || share->last_version' fails in test_if_reopen or unexpected ER_LOCK_DEADLOCK
3+
#
4+
--source include/have_partition.inc
5+
create table t1 (i int) engine=myisam partition by hash(i) partitions 2 ;
6+
lock table t1 write;
7+
truncate table t1;
8+
desc t1;
9+
drop table t1;
10+

sql/sql_truncate.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
400400
{
401401
DEBUG_SYNC(thd, "upgrade_lock_for_truncate");
402402
/* To remove the table from the cache we need an exclusive lock. */
403-
if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DROP))
403+
if (wait_while_table_is_used(thd, table,
404+
*hton_can_recreate ? HA_EXTRA_PREPARE_FOR_DROP : HA_EXTRA_NOT_USED))
404405
DBUG_RETURN(TRUE);
405406
m_ticket_downgrade= table->mdl_ticket;
406407
/* Close if table is going to be recreated. */

0 commit comments

Comments
 (0)