Bug #93540 Provide info about all user level locks with the same name in P_S.metadata_locks
Submitted: 10 Dec 2018 11:09 Modified: 14 Dec 2018 14:20
Reporter: Valeriy Kravchuk Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S4 (Feature request)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: metadata_locks, performance_schema, user lock

[10 Dec 2018 11:09] Valeriy Kravchuk
Description:
Manual (https://dev.mysql.com/doc/refman/8.0/en/locking-functions.html#function_get-lock) says (as a result of Bug #93043 fixed):

"Uniquely named locks acquired with GET_LOCK() appear in the Performance Schema metadata_locks table. The OBJECT_TYPE column says USER LEVEL LOCK and the OBJECT_NAME column indicates the lock name. In the case that multiple locks are acquired for the same name, only the first lock for the name registers a row in the metadata_locks table. Subsequent locks for the name increment a counter in the lock but do not acquire additional metadata locks. The metadata_locks row for the lock is deleted when the last lock instance on the name is released."

Please, consider adding information about each user level lock with the same name set by the user, either in performance_schema.metadata_locks table or in a separate new table like performance_schema.user_locks, so we have a way to see when and what user locks are really requested.

How to repeat:
Try to find out more details (via performance_schema) about each user lock set.

Suggested fix:
Implement separate performance_schema.user_locks table to track each instance of user lock, with column to reference the metadata lock (from metadata_locks table) used to implement this user lock.
[14 Dec 2018 14:20] MySQL Verification Team
Hi,

Thank you for your report.

I find that your feature request is fully justified.
[14 Dec 2018 14:21] MySQL Verification Team
Verified as reported.