diff options
author | davi@endora.local <> | 2007-11-20 15:17:53 -0200 |
---|---|---|
committer | davi@endora.local <> | 2007-11-20 15:17:53 -0200 |
commit | 94e6e4ff4451b9fc7e48bdaf26183ce057f40eed (patch) | |
tree | 54ea6067ff9eaa2f151e4ece310c166653d13957 /sql/sql_rename.cc | |
parent | 6223deb694946e5a2c3e46eaf4f2ce5624b5e78a (diff) | |
download | mariadb-git-94e6e4ff4451b9fc7e48bdaf26183ce057f40eed.tar.gz |
Bug#31397 Inconsistent drop table behavior of handler tables.
The problem is that DROP TABLE and other DDL statements failed to
automatically close handlers associated with tables that were marked
for reopen (FLUSH TABLES).
The current implementation fails to properly discard handlers of
dropped tables (that were marked for reopen) because it searches
on the open handler tables list and using the current alias of the
table being dropped. The problem is that it must not use the open
handler tables list to search because the table might have been
closed (marked for reopen) by a flush tables command and also it
must not use the current table alias at all since multiple different
aliases may be associated with a single table. This is specially
visible when a user has two open handlers (using alias) of a same
table and a flush tables command is issued before the table is
dropped (see test case). Scanning the handler table list is also
useless for dropping handlers associated with temporary tables,
because temporary tables are not kept in the THD::handler_tables
list.
The solution is to simple scan the handlers hash table searching
for, and deleting all handlers with matching table names if the
reopen flag is not passed to the flush function, indicating that
the handlers should be deleted. All matching handlers are deleted
even if the associated the table is not open.
Diffstat (limited to 'sql/sql_rename.cc')
-rw-r--r-- | sql/sql_rename.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 750bcd50479..66d89edc146 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -51,6 +51,8 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent) DBUG_RETURN(1); } + mysql_ha_rm_tables(thd, table_list); + if (wait_if_global_read_lock(thd,0,1)) DBUG_RETURN(1); |