Skip to content

Commit

Permalink
MDEV-26043: Fix performance_schema instrument "threadpool/group_mutex"
Browse files Browse the repository at this point in the history
The performance_schema data related to instrument "wait/synch/mutex/threadpool/group_mutex" was incorrect. The root cause is the group_mutex was initialized in thread_group_init before registerd in PSI_register(mutex).
The fix is to put PSI_register before thread_group_init, which ensures the right order.
  • Loading branch information
zwang28 authored and vaintroub committed Jul 19, 2021
1 parent fc2ec25 commit ddad20c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sql/threadpool_generic.cc
Expand Up @@ -1601,6 +1601,9 @@ int TP_pool_generic::init()
sql_print_error("Allocation failed");
DBUG_RETURN(-1);
}
PSI_register(mutex);
PSI_register(cond);
PSI_register(thread);
scheduler_init();
threadpool_started= true;
for (uint i= 0; i < threadpool_max_size; i++)
Expand All @@ -1614,10 +1617,6 @@ int TP_pool_generic::init()
sql_print_error("Can't set threadpool size to %d",threadpool_size);
DBUG_RETURN(-1);
}
PSI_register(mutex);
PSI_register(cond);
PSI_register(thread);

pool_timer.tick_interval= threadpool_stall_limit;
start_timer(&pool_timer);
DBUG_RETURN(0);
Expand Down

0 comments on commit ddad20c

Please sign in to comment.