summaryrefslogtreecommitdiff
path: root/sql/wsrep_var.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-10-13 10:05:29 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-10-13 10:05:29 +0300
commit588efca2374536aab956e6366f96082f2886c73c (patch)
treeaf1b126c795cd1255d7c7d72c201c01339119755 /sql/wsrep_var.cc
parentb6ebadaa66ee68b1880c0e10669543d1ba058c18 (diff)
parent1feccb505f9ec5cada8f8e2c544f736c1a533633 (diff)
downloadmariadb-git-588efca2374536aab956e6366f96082f2886c73c.tar.gz
Merge 10.6 into 10.7
Diffstat (limited to 'sql/wsrep_var.cc')
-rw-r--r--sql/wsrep_var.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index ea5ba6c1aca..4f4e7817fef 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;
}