summaryrefslogtreecommitdiff
path: root/sql/sql_truncate.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-03-03 09:41:50 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-03-03 09:41:50 +0200
commitddbc6126920c1ad0300f7f9734348309f5073de7 (patch)
treef98a56b0fef476345979f3a228de8ffd27da0ea6 /sql/sql_truncate.cc
parent0f81ca6a0bb21fbba4bca93a7555f7c8e6357b47 (diff)
parent676987c4a14069d415c56d0f259aaaa7ca742c23 (diff)
downloadmariadb-git-ddbc6126920c1ad0300f7f9734348309f5073de7.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_truncate.cc')
-rw-r--r--sql/sql_truncate.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 577f5a2b00f..897db0a2b21 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -443,6 +443,15 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
*/
error= handler_truncate(thd, table_ref, FALSE);
+ if (error == TRUNCATE_OK && thd->locked_tables_mode &&
+ (table_ref->table->file->ht->flags &
+ HTON_REQUIRES_CLOSE_AFTER_TRUNCATE))
+ {
+ thd->locked_tables_list.mark_table_for_reopen(thd, table_ref->table);
+ if (unlikely(thd->locked_tables_list.reopen_tables(thd, true)))
+ thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
+ }
+
/*
All effects of a TRUNCATE TABLE operation are committed even if
truncation fails in the case of non transactional tables. Thus, the