summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2019-05-13 12:46:50 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2019-05-14 11:25:42 +0300
commit3d8cacee6e8fa5bbcb5913088050b1e61e357f25 (patch)
treeddaeb610459aad1e8fbf6720253b0ee6e61f4151
parent41779561ec543787b073a1506a2291f6f89cff48 (diff)
downloadmariadb-git-3d8cacee6e8fa5bbcb5913088050b1e61e357f25.tar.gz
MDEV-19404: Assertion failure on !is_thread_specific || (mysqld_server_initialized && thd)
In wsrep_plugins_post_init we iterate all theads and if they are galera appliers (wsrep_applier) we init session variables. However, current_thd was not set and recent changes on session variables require holding LOCK_gloal_system_variables mutex. This is 10.4 version.
-rw-r--r--sql/sql_plugin.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 82b4e85e6b3..a6c7bb76055 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -4352,20 +4352,28 @@ void wsrep_plugins_pre_init()
my_bool post_init_callback(THD *thd, void *)
{
+ DBUG_ASSERT(!current_thd);
if (thd->wsrep_applier)
{
- // Save options_bits as it will get overwritten in plugin_thdvar_init()
+ // Save options_bits as it will get overwritten in
+ // plugin_thdvar_init() (verified)
ulonglong option_bits_saved= thd->variables.option_bits;
+
+ set_current_thd(thd);
plugin_thdvar_init(thd);
+
// Restore option_bits
thd->variables.option_bits= option_bits_saved;
}
+ set_current_thd(0);
return 0;
}
void wsrep_plugins_post_init()
{
+ mysql_mutex_lock(&LOCK_global_system_variables);
server_threads.iterate(post_init_callback);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
}
#endif /* WITH_WSREP */