summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwang28 <84491488@qq.com>2021-06-29 20:23:29 +0800
committerVladislav Vaintroub <wlad@mariadb.com>2021-07-19 12:32:31 +0200
commitddad20c63be0a3725e6b349a15a03eae82b2d381 (patch)
tree4d56ba2be6e2d5faf148526b9d391705612bb0e8
parentfc2ec25733c6f1a305bf14df960ee7a02b48ef2c (diff)
downloadmariadb-git-ddad20c63be0a3725e6b349a15a03eae82b2d381.tar.gz
MDEV-26043: Fix performance_schema instrument "threadpool/group_mutex"
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.
-rw-r--r--sql/threadpool_generic.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index f59c7cbea9d..b34104dbd08 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -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++)
@@ -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);