Skip to content

Commit ec002a1

Browse files
committed
MDEV-11176: FTWRL confusing state about "worker thread pool"
The FLUSH TABLE WITH READ LOCK briefly set the state (in PROCESSLIST) to "Waiting while replication worker thread pool is busy", even if there was nothing to wait for. This is somewhat confusing on a server that might not even have any replication configured, let alone replication workers. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
1 parent db8dfe0 commit ec002a1

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

mysql-test/suite/perfschema/r/stage_mdl_global.result

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ username event_name nesting_event_type
1010
username event_name nesting_event_type
1111
user1 stage/sql/starting STATEMENT
1212
user1 stage/sql/starting STATEMENT
13-
user1 stage/sql/starting STATEMENT
1413
user1 stage/sql/Query end STATEMENT
1514
user1 stage/sql/closing tables STATEMENT
1615
user1 stage/sql/Query end STATEMENT

sql/rpl_parallel.cc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ pool_mark_busy(rpl_parallel_thread_pool *pool, THD *thd)
552552
{
553553
PSI_stage_info old_stage;
554554
int res= 0;
555+
bool did_enter_cond= false;
555556

556557
/*
557558
Wait here while the queue is busy. This is done to make FLUSH TABLES WITH
@@ -568,24 +569,28 @@ pool_mark_busy(rpl_parallel_thread_pool *pool, THD *thd)
568569
*/
569570
DBUG_EXECUTE_IF("mark_busy_mdev_22370",my_sleep(1000000););
570571
mysql_mutex_lock(&pool->LOCK_rpl_thread_pool);
571-
if (thd)
572-
{
573-
thd->set_time_for_next_stage();
574-
thd->ENTER_COND(&pool->COND_rpl_thread_pool, &pool->LOCK_rpl_thread_pool,
575-
&stage_waiting_for_rpl_thread_pool, &old_stage);
576-
}
577-
while (pool->busy)
572+
if (pool->busy)
578573
{
579-
if (thd && unlikely(thd->check_killed()))
574+
if (thd)
580575
{
581-
res= 1;
582-
break;
576+
thd->set_time_for_next_stage();
577+
thd->ENTER_COND(&pool->COND_rpl_thread_pool, &pool->LOCK_rpl_thread_pool,
578+
&stage_waiting_for_rpl_thread_pool, &old_stage);
579+
did_enter_cond= true;
583580
}
584-
mysql_cond_wait(&pool->COND_rpl_thread_pool, &pool->LOCK_rpl_thread_pool);
581+
do
582+
{
583+
if (thd && unlikely(thd->check_killed()))
584+
{
585+
res= 1;
586+
break;
587+
}
588+
mysql_cond_wait(&pool->COND_rpl_thread_pool, &pool->LOCK_rpl_thread_pool);
589+
} while (pool->busy);
585590
}
586591
if (!res)
587592
pool->busy= true;
588-
if (thd)
593+
if (did_enter_cond)
589594
thd->EXIT_COND(&old_stage);
590595
else
591596
mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool);

0 commit comments

Comments
 (0)