Issue with wsrep_slave_threads

Bug #1290612 reported by Raghavendra D Prabhu on 2014-03-11
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
High
Unassigned
5.5
High
Unassigned
Percona XtraDB Cluster
Status tracked in 5.6
5.5
Undecided
Unassigned
5.6
Undecided
Unassigned

Bug Description

set global wsrep_slave_threads=12;
set global wsrep_slave_threads=1;
set global wsrep_slave_threads=12;

causes total number of threads to 24. This is because there is no condition checking for this.

=== modified file 'sql/wsrep_applier.cc'
--- sql/wsrep_applier.cc 2013-11-10 11:09:20 +0000
+++ sql/wsrep_applier.cc 2014-03-10 23:19:08 +0000
@@ -325,6 +325,7 @@
     if (wsrep_slave_count_change < 0)
     {
       wsrep_slave_count_change++;
+ WSREP_DEBUG("Closing applier thread, to close %d", abs(wsrep_slave_count_change));
       *exit = true;
     }
     mysql_mutex_unlock(&LOCK_wsrep_slave_threads);

=== modified file 'sql/wsrep_var.cc'
--- sql/wsrep_var.cc 2014-02-27 11:31:26 +0000
+++ sql/wsrep_var.cc 2014-03-10 23:22:30 +0000
@@ -475,17 +475,22 @@

 bool wsrep_slave_threads_check (sys_var *self, THD* thd, set_var* var)
 {
+ if (wsrep_slave_count_change != 0) {
+ WSREP_DEBUG("Still closing existing threads - %d", abs(wsrep_slave_count_change));
+ return true;
+ }
   mysql_mutex_lock(&LOCK_wsrep_slave_threads);
   wsrep_slave_count_change = var->value->val_int() - wsrep_slave_threads;
   mysql_mutex_unlock(&LOCK_wsrep_slave_threads);

- return 0;
+ return false;
 }

 bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
 {
   if (wsrep_slave_count_change > 0)
   {
+ WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads);
     wsrep_create_appliers(wsrep_slave_count_change);
     wsrep_slave_count_change = 0;
   }

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers