Commit 2a6aa0a3 authored by Seppo Jaakola's avatar Seppo Jaakola

References https://mariadb.atlassian.net/browse/MDEV-4136

Fixes to stop wsrep replicator when thread pool scheduler is in use
parent 53f5ea24
...@@ -4853,6 +4853,14 @@ pthread_handler_t start_wsrep_THD(void *arg) ...@@ -4853,6 +4853,14 @@ pthread_handler_t start_wsrep_THD(void *arg)
// 'Error in my_thread_global_end(): 2 threads didn't exit' // 'Error in my_thread_global_end(): 2 threads didn't exit'
// at server shutdown // at server shutdown
} }
if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
{
mysql_mutex_lock(&LOCK_thread_count);
delete thd;
thread_count--;
mysql_mutex_unlock(&LOCK_thread_count);
}
return(NULL); return(NULL);
} }
...@@ -5175,6 +5183,13 @@ void wsrep_wait_appliers_close(THD *thd) ...@@ -5175,6 +5183,13 @@ void wsrep_wait_appliers_close(THD *thd)
// This gotta be fixed in a more elegant manner if we gonna have arbitrary // This gotta be fixed in a more elegant manner if we gonna have arbitrary
// number of non-applier wsrep threads. // number of non-applier wsrep threads.
{ {
if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
{
mysql_mutex_unlock(&LOCK_thread_count);
my_sleep(100);
mysql_mutex_lock(&LOCK_thread_count);
}
else
mysql_cond_wait(&COND_thread_count,&LOCK_thread_count); mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
DBUG_PRINT("quit",("One applier died (count=%u)",thread_count)); DBUG_PRINT("quit",("One applier died (count=%u)",thread_count));
} }
...@@ -5185,6 +5200,13 @@ void wsrep_wait_appliers_close(THD *thd) ...@@ -5185,6 +5200,13 @@ void wsrep_wait_appliers_close(THD *thd)
mysql_mutex_lock(&LOCK_thread_count); mysql_mutex_lock(&LOCK_thread_count);
while (have_wsrep_appliers(thd) > 0) while (have_wsrep_appliers(thd) > 0)
{ {
if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
{
mysql_mutex_unlock(&LOCK_thread_count);
my_sleep(100);
mysql_mutex_lock(&LOCK_thread_count);
}
else
mysql_cond_wait(&COND_thread_count,&LOCK_thread_count); mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
DBUG_PRINT("quit",("One thread died (count=%u)",thread_count)); DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment