1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Ramil Kalimullin
2009-08-21 10:55:35 +05:00
parent 1317d24b33
commit fb9ba3734b
3 changed files with 39 additions and 0 deletions

View File

@ -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)))
{