diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 133527c4bea..8f2feed2eb9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5224,19 +5224,19 @@ static int init_server_components() if (tmp->wsrep_applier == true) { /* - Set THR_THD to temporally point to this THD to register all the + Save/restore server_status and variables.option_bits and they get + altered during init_for_queries(). + */ + unsigned int server_status_saved= tmp->server_status; + ulonglong option_bits_saved= tmp->variables.option_bits; + + /* + Set THR_THD to temporarily point to this THD to register all the variables that allocates memory for this THD. */ THD *current_thd_saved= current_thd; set_current_thd(tmp); - /* - Also save/restore server_status and variables.option_bits and they - get altered during init_for_queries(). - */ - unsigned int server_status_saved= tmp->server_status; - ulonglong option_bits_saved= tmp->variables.option_bits; - tmp->init_for_queries(); /* Restore current_thd. */ diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 1796d4549c7..089f60a2dd8 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -310,6 +310,16 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, } } +#ifdef WITH_WSREP + if (thd && thd->wsrep_applier) + { + /* + In case of applier thread, do not wait for table share(s) to be + removed from table definition cache. + */ + options|= REFRESH_FAST; + } +#endif if (close_cached_tables(thd, tables, ((options & REFRESH_FAST) ? FALSE : TRUE), (thd ? thd->variables.lock_wait_timeout :