diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index bd762f916bcea..438e4730f5723 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -195,9 +195,6 @@ SET GLOBAL wsrep_slave_threads= 10; SHOW STATUS LIKE 'threads_connected'; Variable_name Value Threads_connected 1 -SHOW STATUS LIKE 'wsrep_thread_count'; -Variable_name Value -wsrep_thread_count 11 SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved; SET GLOBAL wsrep_provider= none; SET GLOBAL wsrep_cluster_address= ''; diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index 6cc895a75d926..22f4c6cb94028 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -120,9 +120,8 @@ SHOW STATUS LIKE 'wsrep_thread_count'; SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads; SET GLOBAL wsrep_slave_threads= 10; --echo # Wait for applier threads to get created. -sleep 3; +sleep 5; SHOW STATUS LIKE 'threads_connected'; -SHOW STATUS LIKE 'wsrep_thread_count'; # reset (for mtr internal checks) SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved; diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index c1b15bd02c269..c74bb528ebd28 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1711,7 +1711,7 @@ static bool abort_replicated(THD *thd) bool ret_code= false; if (thd->wsrep_query_state== QUERY_COMMITTING) { - if (wsrep_debug) WSREP_INFO("aborting replicated trx: %lu", thd->real_id); + WSREP_DEBUG("aborting replicated trx: %lu", thd->real_id); (void)wsrep_abort_thd(thd, thd, TRUE); ret_code= true; @@ -1769,24 +1769,6 @@ static bool have_client_connections() return false; } -/* - returns the number of wsrep appliers running. - However, the caller (thd parameter) is not taken in account - */ -static int have_wsrep_appliers(THD *thd) -{ - int ret= 0; - THD *tmp; - - I_List_iterator it(threads); - while ((tmp=it++)) - { - ret+= (tmp != thd && tmp->wsrep_applier); - } - return ret; -} - - static void wsrep_close_thread(THD *thd) { thd->killed= KILL_CONNECTION; @@ -1894,7 +1876,7 @@ void wsrep_close_client_connections(my_bool wait_to_end) while ((tmp=it2++)) { #ifndef __bsdi__ // Bug in BSDI kernel - if (is_client_connection(tmp) && + if (is_client_connection(tmp) && !abort_replicated(tmp) && !is_replaying_connection(tmp)) { @@ -1905,8 +1887,7 @@ void wsrep_close_client_connections(my_bool wait_to_end) } DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count)); - if (wsrep_debug) - WSREP_INFO("waiting for client connections to close: %u", thread_count); + WSREP_DEBUG("waiting for client connections to close: %u", thread_count); while (wait_to_end && have_client_connections()) { @@ -1950,35 +1931,11 @@ void wsrep_close_threads(THD *thd) mysql_mutex_unlock(&LOCK_thread_count); } - -void wsrep_close_applier_threads(int count) -{ - THD *tmp; - mysql_mutex_lock(&LOCK_thread_count); // For unlink from list - - I_List_iterator it(threads); - while ((tmp=it++) && count) - { - DBUG_PRINT("quit",("Informing thread %ld that it's time to die", - tmp->thread_id)); - /* We skip slave threads & scheduler on this first loop through. */ - if (tmp->wsrep_applier) - { - WSREP_DEBUG("closing wsrep applier thread %ld", tmp->thread_id); - tmp->wsrep_applier_closing= TRUE; - count--; - } - } - - mysql_mutex_unlock(&LOCK_thread_count); -} - - void wsrep_wait_appliers_close(THD *thd) { /* Wait for wsrep appliers to gracefully exit */ mysql_mutex_lock(&LOCK_thread_count); - while (have_wsrep_appliers(thd) > 1) + while (wsrep_running_threads > 1) // 1 is for rollbacker thread which needs to be killed explicitly. // This gotta be fixed in a more elegant manner if we gonna have arbitrary // number of non-applier wsrep threads. @@ -1998,7 +1955,7 @@ void wsrep_wait_appliers_close(THD *thd) wsrep_close_threads (thd); /* and wait for them to die */ mysql_mutex_lock(&LOCK_thread_count); - while (have_wsrep_appliers(thd) > 0) + while (wsrep_running_threads > 0) { if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION) {