diff options
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r-- | sql/wsrep_mysqld.cc | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index d61ebb047d6..0637b4db7df 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -47,6 +47,7 @@ #include <string> #include "log_event.h" #include <slave.h> +#include "sql_plugin.h" /* wsrep_plugins_pre_init() */ #include <sstream> @@ -153,7 +154,11 @@ mysql_mutex_t LOCK_wsrep_SR_pool; mysql_mutex_t LOCK_wsrep_SR_store; int wsrep_replaying= 0; -ulong wsrep_running_threads= 0; // # of currently running wsrep threads +ulong wsrep_running_threads = 0; // # of currently running wsrep + // # threads +ulong wsrep_running_applier_threads = 0; // # of running applier threads +ulong wsrep_running_rollbacker_threads = 0; // # of running + // # rollbacker threads ulong my_bind_addr; #ifdef HAVE_PSI_INTERFACE @@ -2658,7 +2663,21 @@ void* start_wsrep_THD(void *arg) thd->set_command(COM_SLEEP); thd->init_for_queries(); mysql_mutex_lock(&LOCK_wsrep_slave_threads); + wsrep_running_threads++; + + switch (thd_args->thread_type()) { + case WSREP_APPLIER_THREAD: + wsrep_running_applier_threads++; + break; + case WSREP_ROLLBACKER_THREAD: + wsrep_running_rollbacker_threads++; + break; + default: + WSREP_ERROR("Incorrect wsrep thread type: %d", thd_args->thread_type()); + break; + } + mysql_cond_broadcast(&COND_wsrep_slave_threads); mysql_mutex_unlock(&LOCK_wsrep_slave_threads); @@ -2678,7 +2697,23 @@ void* start_wsrep_THD(void *arg) delete thd_args; mysql_mutex_lock(&LOCK_wsrep_slave_threads); + DBUG_ASSERT(wsrep_running_threads > 0); wsrep_running_threads--; + + switch (thd_args->thread_type()) { + case WSREP_APPLIER_THREAD: + DBUG_ASSERT(wsrep_running_applier_threads > 0); + wsrep_running_applier_threads--; + break; + case WSREP_ROLLBACKER_THREAD: + DBUG_ASSERT(wsrep_running_rollbacker_threads > 0); + wsrep_running_rollbacker_threads--; + break; + default: + WSREP_ERROR("Incorrect wsrep thread type: %d", thd_args->thread_type()); + break; + } + WSREP_DEBUG("wsrep running threads now: %lu", wsrep_running_threads); mysql_cond_broadcast(&COND_wsrep_slave_threads); mysql_mutex_unlock(&LOCK_wsrep_slave_threads); |