diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_class.cc | 13 | ||||
-rw-r--r-- | sql/sql_class.h | 1 | ||||
-rw-r--r-- | sql/sys_vars.cc | 6 |
3 files changed, 16 insertions, 4 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 5ada018e540..dcfdf40c964 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1353,8 +1353,7 @@ void THD::change_user(void) my_hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0, (my_hash_get_key) get_var_key, (my_hash_free_key) free_user_var, 0); - sp_cache_clear(&sp_proc_cache); - sp_cache_clear(&sp_func_cache); + clear_sp_caches(); } @@ -1410,8 +1409,7 @@ void THD::cleanup(void) #endif /* defined(ENABLED_DEBUG_SYNC) */ my_hash_free(&user_vars); - sp_cache_clear(&sp_proc_cache); - sp_cache_clear(&sp_func_cache); + clear_sp_caches(); auto_inc_intervals_forced.empty(); auto_inc_intervals_in_cur_stmt_for_binlog.empty(); @@ -2123,6 +2121,13 @@ void THD::cleanup_after_query() } +void THD::clear_sp_caches() +{ + sp_cache_clear(&sp_proc_cache); + sp_cache_clear(&sp_func_cache); +} + + /* Convert a string to another character set diff --git a/sql/sql_class.h b/sql/sql_class.h index 5f871f9caf6..2cf0f3f4530 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3209,6 +3209,7 @@ public: void change_user(void); void cleanup(void); void cleanup_after_query(); + void clear_sp_caches(); void free_connection(); void reset_for_reuse(); bool store_globals(); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index e4de3d8d0aa..585806fdce5 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -53,6 +53,7 @@ #include "log_slow.h" #include "debug_sync.h" // DEBUG_SYNC #include "sql_show.h" +#include "sp_cache.h" // sp_cache_invalidate() #include "log_event.h" #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE @@ -2469,6 +2470,11 @@ static bool fix_optimizer_switch(sys_var *self, THD *thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), "engine_condition_pushdown=on"); + if (type == OPT_GLOBAL) + sp_cache_invalidate(); + else + thd->clear_sp_caches(); + return false; } static bool check_legal_optimizer_switch(sys_var *self, THD *thd, |