Commit 7fc25cfb authored by Monty's avatar Monty

Fix for MDEV-12730

Assertion `count > 0' failed in rpl_parallel_thread_pool::
get_thread, rpl.rpl_parallel failed in buildbot

The reason for this is that one thread can call
rpl_parallel_resize_pool_if_no_slaves() while
another thread calls at the same time
rpl_parallel_activate_pool(). If rpl_parallel_active_pool() is
called before rpl_parallel_resize_pool_if_no_slaves() has
finished, pool->count will be set to 0 even if there exists
active slave threads.

Added a mutex lock in rpl_parallel_activate_pool() to protect against this scenario, which seams to fix this issue.
parent 0dbe3dbe
......@@ -1623,10 +1623,19 @@ int rpl_parallel_resize_pool_if_no_slaves(void)
}
/**
Resize pool if not active or busy (in which case we may be in
resize to 0
*/
int
rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool)
{
if (!pool->count)
bool resize;
mysql_mutex_lock(&pool->LOCK_rpl_thread_pool);
resize= !pool->count || pool->busy;
mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool);
if (resize)
return rpl_parallel_change_thread_count(pool, opt_slave_parallel_threads,
0);
return 0;
......
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