diff options
Diffstat (limited to 'sql/wsrep_var.cc')
-rw-r--r-- | sql/wsrep_var.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 357fbf616ce..26853b34dc0 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -1,4 +1,4 @@ -/* Copyright 2008-2021 Codership Oy <http://www.codership.com> +/* Copyright 2008-2022 Codership Oy <http://www.codership.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -119,8 +119,7 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type) if (wsrep_init()) { - my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, my_error, "wsrep_init failed"); - //rcode= true; + my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, errno, "wsrep_init failed"); saved_wsrep_on= false; } @@ -791,11 +790,22 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) { WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads); res= wsrep_create_appliers(wsrep_slave_count_change, true); + mysql_mutex_unlock(&LOCK_global_system_variables); + mysql_mutex_unlock(&LOCK_wsrep_slave_threads); + // Thread creation and execution is asyncronous, therefore we need + // wait them to be started or error produced + while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads) + { + my_sleep(1000); + } + + mysql_mutex_lock(&LOCK_global_system_variables); + WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads); wsrep_slave_count_change = 0; } - - mysql_mutex_unlock(&LOCK_wsrep_slave_threads); + else + mysql_mutex_unlock(&LOCK_wsrep_slave_threads); return res; } |