summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2009-12-02 18:22:15 +0300
committerKonstantin Osipov <kostja@sun.com>2009-12-02 18:22:15 +0300
commit3104af49cdd1a3c041948b0da17558c49c3edb49 (patch)
treee25111d23124912ae062b22e9503051a57bb23c3 /sql/sql_db.cc
parente8a9191e646ab510e14082793fed2d828e6c8679 (diff)
downloadmariadb-git-3104af49cdd1a3c041948b0da17558c49c3edb49.tar.gz
Backport of:
---------------------------------------------------------- revno: 2630.10.1 committer: Konstantin Osipov <konstantin@mysql.com> branch nick: mysql-6.0-lock-tables-tidyup timestamp: Wed 2008-06-11 15:49:58 +0400 message: WL#3726, review fixes. Now that we have metadata locks, we don't need to keep a crippled TABLE instance in the table cache to indicate that a table is locked. Remove all code that used this technique. Instead, rely on metadata locks and use the standard open_table() and close_thread_table() to manipulate with the table cache tables. Removes a list of functions that have become unused (see the comment for sql_base.cc for details). Under LOCK TABLES, keep a TABLE_LIST instance for each table that may be temporarily closed. For that, implement an own class for LOCK TABLES mode, Locked_tables_list. This is a pre-requisite patch for WL#4144. This is not exactly a backport: there is no new online ALTER table in Celosia, so the old alter table code was changed to work with the new table cache API. mysql-test/r/lock.result: Update results (WL#3726 post-review patch). mysql-test/r/trigger-compat.result: We take the table from the table cache now, thus no warning. mysql-test/suite/rpl/r/rpl_trigger.result: We take the table from the table cache now, thus no warning. mysql-test/t/lock.test: Additional tests for LOCK TABLES mode (previously not covered by the test suite (WL#3726). sql/field.h: Remove reopen_table(). sql/lock.cc: Remove an obsolete parameter of mysql_lock_remove(). It's not used anywhere now either. sql/mysql_priv.h: Add 4 new open_table() flags. Remove declarations of removed functions. sql/sp_head.cc: Rename thd->mdl_el_root to thd->locked_tables_root. sql/sql_acl.cc: Use the new implementation of unlock_locked_tables(). sql/sql_base.cc: Implement class Locked_tables_list. Implement close_all_tables_for_name(). Rewrite close_cached_tables() to use the new reopen_tables(). Remove reopen_table(), reopen_tables(), reopen_table_entry() (ex. open_unireg_entry()), close_data_files_and_leave_as_placeholders(), close_handle_and_leave_table_as_placeholder(), close_cached_table(), table_def_change_share(), reattach_merge(), reopen_name_locked_table(), unlink_open_table(). Move acquisition of a metadata lock into an own function - open_table_get_mdl_lock(). sql/sql_class.cc: Deploy class Locked_tables_list. sql/sql_class.h: Declare class Locked_tables_list. Keep one instance of this class in class THD. Rename mdl_el_root to locked_tables_root. sql/sql_db.cc: Update a comment. sql/sql_insert.cc: Use the plain open_table() to open a just created table in CREATE TABLE .. SELECT. sql/sql_parse.cc: Use thd->locked_tables_list to enter and leave LTM_LOCK_TABLES mode. sql/sql_partition.cc: Deploy the new method of working with partitioned table locks. sql/sql_servers.cc: Update to the new signature of unlock_locked_tables(). sql/sql_table.cc: In mysql_rm_table_part2(), the branch that removes a table under LOCK TABLES, make sure that the table being dropped is also removed from THD::locked_tables_list. Update ALTER TABLE and CREATE TABLE LIKE implementation to use open_table() and close_all_tables_for_name() instead of reopen_tables(). sql/sql_trigger.cc: Use the new locking way. sql/table.h: Add TABLE::pos_in_locked_tables, which is used only under LOCK TABLES.
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index b5c51601faf..1b61a96d7ff 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -1956,8 +1956,8 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
/*
Step7: drop the old database.
- remove_db_from_cache(olddb) and query_cache_invalidate(olddb)
- are done inside mysql_rm_db(), no needs to execute them again.
+ query_cache_invalidate(olddb) is done inside mysql_rm_db(), no need
+ to execute them again.
mysql_rm_db() also "unuses" if we drop the current database.
*/
error= mysql_rm_db(thd, old_db->str, 0, 1);