summaryrefslogtreecommitdiff
path: root/sql/sql_truncate.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-07-16 15:12:38 +0200
committerSergei Golubchik <serg@mariadb.org>2018-07-19 11:35:39 +0200
commitd57ddaa1904d3c2f08460c539c72652f0c78c09a (patch)
tree72b53c0f274266155092317fad413fe667dde58f /sql/sql_truncate.cc
parent5c744bb5350acbf2d3abce28d01fc829c4f2375c (diff)
downloadmariadb-git-d57ddaa1904d3c2f08460c539c72652f0c78c09a.tar.gz
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
Diffstat (limited to 'sql/sql_truncate.cc')
-rw-r--r--sql/sql_truncate.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 75a0678928b..f5161c09b2c 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -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. */