diff options
Diffstat (limited to 'sql/sql_reload.cc')
-rw-r--r-- | sql/sql_reload.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 5b4600ece9a..8f87d633d19 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -22,6 +22,7 @@ #include "sql_acl.h" // acl_reload #include "sql_servers.h" // servers_reload #include "sql_connect.h" // reset_mqh +#include "thread_cache.h" #include "sql_base.h" // close_cached_tables #include "sql_db.h" // my_dbopt_cleanup #include "hostname.h" // hostname_cache_refresh @@ -133,7 +134,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, logger.flush_general_log(); if (options & REFRESH_ENGINE_LOG) - if (ha_flush_logs(NULL)) + if (ha_flush_logs()) result= 1; if (options & REFRESH_BINARY_LOG) @@ -352,7 +353,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, if (thd && (options & REFRESH_STATUS)) refresh_status(thd); if (options & REFRESH_THREADS) - flush_thread_cache(); + thread_cache.flush(); #ifdef HAVE_REPLICATION if (options & REFRESH_MASTER) { @@ -515,7 +516,6 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) { Lock_tables_prelocking_strategy lock_tables_prelocking_strategy; - TABLE_LIST *table_list; /* This is called from SQLCOM_FLUSH, the transaction has @@ -555,16 +555,10 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) DEBUG_SYNC(thd,"flush_tables_with_read_lock_after_acquire_locks"); - for (table_list= all_tables; table_list; + /* Reset ticket to satisfy asserts in open_tables(). */ + for (auto table_list= all_tables; table_list; table_list= table_list->next_global) - { - /* Request removal of table from cache. */ - tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, - table_list->db.str, - table_list->table_name.str, FALSE); - /* Reset ticket to satisfy asserts in open_tables(). */ table_list->mdl_request.ticket= NULL; - } } thd->variables.option_bits|= OPTION_TABLE_LOCK; @@ -599,6 +593,16 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) } } + if (thd->lex->type & REFRESH_READ_LOCK) + { + for (auto table_list= all_tables; table_list; + table_list= table_list->next_global) + { + if (table_list->table->file->extra(HA_EXTRA_FLUSH)) + goto error_reset_bits; + } + } + if (thd->locked_tables_list.init_locked_tables(thd)) goto error_reset_bits; |