From edde990e35f4760e419bad1f0cb5b57ea9e2f863 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Mon, 26 Jul 2021 16:31:22 +0530 Subject: MDEV-23365: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon killed TRUNCATE Note: This is a backport of 1cb4caa66d5fd2a9bc095d68988324b7b358d70f from 10.3 Analysis: Assertion failure happens because less session memory is set and so table can't be reopened. So the statement can't be used. This error goes unreported. Fix: Return the error state. --- sql/sql_truncate.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/sql_truncate.cc') diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 7d1f630b88c..e5165c5a855 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -426,8 +426,10 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref) error= dd_recreate_table(thd, table_ref->db, table_ref->table_name); if (thd->locked_tables_mode && thd->locked_tables_list.reopen_tables(thd, false)) + { thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); - + error= 1; + } /* No need to binlog a failed truncate-by-recreate. */ binlog_stmt= !error; } -- cgit v1.2.1