summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-08-21 10:55:35 +0500
committerRamil Kalimullin <ramil@mysql.com>2009-08-21 10:55:35 +0500
commitfb9ba3734bf1faaecbdab204b0bcdd8954da944f (patch)
treeb9db9b086ed85b224cec080c66f499cc1a743eb9 /sql/sql_delete.cc
parent1317d24b333ecf9e2b9669455c337ceec4b228bf (diff)
downloadmariadb-git-fb9ba3734bf1faaecbdab204b0bcdd8954da944f.tar.gz
Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP
(temporary) TABLE, crash Problem: if one has an open "HANDLER t1", further "TRUNCATE t1" doesn't close the handler and leaves handler table hash in an inconsistent state, that may lead to a server crash. Fix: TRUNCATE should implicitly close all open handlers. Doc. request: the fact should be described in the manual accordingly. mysql-test/r/handler_myisam.result: Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash - test result. mysql-test/t/handler_myisam.test: Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash - test case. sql/sql_delete.cc: Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash - remove all truncated tables from the HANDLER's hash.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 0d4bf3f0b8f..d2f90fa9288 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -1066,6 +1066,10 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
DBUG_ENTER("mysql_truncate");
bzero((char*) &create_info,sizeof(create_info));
+
+ /* Remove tables from the HANDLER's hash. */
+ mysql_ha_rm_tables(thd, table_list, FALSE);
+
/* If it is a temporary table, close and regenerate it */
if (!dont_send_ok && (table= find_temporary_table(thd, table_list)))
{