mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -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
|
int
|
||||||
rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool)
|
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,
|
return rpl_parallel_change_thread_count(pool, opt_slave_parallel_threads,
|
||||||
0);
|
0);
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user