Percona Server supports multiple user level locks per connection as of version 5.6.19-67.0. The GET_LOCK() function in upstream MySQL allows a connection to hold at most one user level lock. Taking a new lock automatically releases the old lock, if any.
The limit of one lock per session existed since early versions of MySQL didn’t have a deadlock detector for SQL locks. Metadata Locking introduced in MySQL 5.5 added a deadlock detector, so starting from 5.5 it became possible to take multiple locks in any order. Deadlock would be detected when occurred, and an error would returned to the client which closed the wait chain.
- Author / Origin: Kostja Osipov