Bug #93043 | MySQL Manual describes get_lock() behavior in a wrong/unclear way | ||
---|---|---|---|
Submitted: | 1 Nov 2018 14:45 | Modified: | 16 Nov 2018 14:26 |
Reporter: | Valeriy Kravchuk | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | GET_LOCK, metadata_locks, missing manual, performance schema |
[1 Nov 2018 14:45]
Valeriy Kravchuk
[1 Nov 2018 16:01]
MySQL Verification Team
Hi, Thank you for your bug report. I truly agree with your analysis. Such text would puzzle me as well. It does require clarification and explanation. Verified as reported.
[16 Nov 2018 14:20]
Paul DuBois
Posted by developer: Comments from Dmitry Lenev about the observations in the bug report: Yes, this is the way it is implemented. Subsequent calls to GET_LOCK() function simply increment counter in auxiliary struct in user-level locks implementation, they don't even reach MDL subsystem. So this is expected that multiple acquisitions of the same user-level lock by connection are visible as a single MDL lock acquistion in P_S. What you observe is expected behavior that corresponds to the way the feature was designed/implemented. Unfortunately, I don't think there is a good way for user to find out how many recursive user-level lock acquisitions of the same lock by the same connection has happened. If you think that this is significant/serious problem the please report a separate feature request about this. We can change user-level lock implementation or invent some extension to P_S to solve this issue.
[16 Nov 2018 14:26]
Paul DuBois
Posted by developer: I've removed the contradictory statement that GET_LOCK() releases locks. Thanks for spotting that. Regarding the single entry in the metadata_locks table for multiple locks on the same name, see previous comment. I've revised the GET_LOCK() description to take that into account: " 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. " If inability to see all instances of a lock on a name is an significant issue, please file a separate feature request referencing Bug#93043. Thanks.