[MDEV-26043] Performance_schema data related to instrument "wait/synch/mutex/threadpool/group_mutex" is incorrect. Created: 2021-06-29  Updated: 2021-07-19  Resolved: 2021-07-19

Status: Closed
Project: MariaDB Server
Component/s: Performance Schema
Affects Version/s: 10.5, 10.6
Fix Version/s: 10.5.12, 10.6.4

Type: Bug Priority: Major
Reporter: Zheng Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None


 Description   

Performance_schema data related to instrument "wait/synch/mutex/threadpool/group_mutex" is incorrect.

How to reproduce:
1. Start a mariadb instance with threadpool and performance_schema both enabled: --thread-handling=pool-of-threads --performance-schema=ON
2. Enable the instrument in performance_schema: CALL sys.ps_setup_enable_instrument('wait/synch/mutex/threadpool/group_mutex');
3. Send any queries to change the instrument's counters, e.g. select * from `performance_schema`.events_waits_summary_global_by_event_name;
4. Verity the bug:

  • All counters are zero in the result of the following SQL, while expected to be greater than zero: select * from `performance_schema`.events_waits_summary_global_by_event_name where event_name = 'wait/synch/mutex/threadpool/group_mutex';
  • The number of group_mutex instance is zero in the result of the following SQL, while expected to be equal to the thread_pool_size: select count(*) from `performance_schema`.mutex_instances where name like 'wait/synch/mutex/threadpool/group_mutex';

Root cause:
The "group_mutex" is expected to be registered and then initialized in TP_pool_generic::init in threadpool_generic.cc. However, initialization was wrongly put before register, specifically the code line thread_group_init before PSI_register(mutex).

How to fix:
Put PSI_register before thread_group_init. I've created a patch in this pull request.


Generated at Thu Feb 08 09:42:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.