=== modified file 'sql/mysqld.cc'
--- sql/mysqld.cc	2014-08-12 18:05:44 +0000
+++ sql/mysqld.cc	2014-08-28 21:51:19 +0000
@@ -5437,7 +5437,7 @@
   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;
@@ -5507,23 +5507,6 @@
   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<THD> it(threads);
-  while ((tmp=it++))
-  {
-    ret+= (tmp != thd && tmp->wsrep_applier);
-  }
-  return ret;
-}
-
 static void wsrep_close_thread(THD *thd)
 {
   thd->killed= KILL_CONNECTION;
@@ -5639,8 +5622,7 @@
   }
 
   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())
   {
@@ -5682,33 +5664,11 @@
   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<THD> 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.
@@ -5728,7 +5688,7 @@
   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)
     {

