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
This commit is contained in:
parent
5c744bb535
commit
d57ddaa190
7
mysql-test/suite/parts/r/truncate_locked.result
Normal file
7
mysql-test/suite/parts/r/truncate_locked.result
Normal file
@ -0,0 +1,7 @@
|
||||
create table t1 (i int) engine=myisam partition by hash(i) partitions 2 ;
|
||||
lock table t1 write;
|
||||
truncate table t1;
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
i int(11) YES NULL
|
||||
drop table t1;
|
10
mysql-test/suite/parts/t/truncate_locked.test
Normal file
10
mysql-test/suite/parts/t/truncate_locked.test
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
--source include/have_partition.inc
|
||||
create table t1 (i int) engine=myisam partition by hash(i) partitions 2 ;
|
||||
lock table t1 write;
|
||||
truncate table t1;
|
||||
desc t1;
|
||||
drop table t1;
|
||||
|
@ -400,7 +400,8 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
|
||||
{
|
||||
DEBUG_SYNC(thd, "upgrade_lock_for_truncate");
|
||||
/* To remove the table from the cache we need an exclusive lock. */
|
||||
if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DROP))
|
||||
if (wait_while_table_is_used(thd, table,
|
||||
*hton_can_recreate ? HA_EXTRA_PREPARE_FOR_DROP : HA_EXTRA_NOT_USED))
|
||||
DBUG_RETURN(TRUE);
|
||||
m_ticket_downgrade= table->mdl_ticket;
|
||||
/* Close if table is going to be recreated. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user