Bug #80721 the new GET_LOCK implementation has a limit on the identifier name
Submitted: 14 Mar 2016 8:13 Modified: 14 Mar 2016 14:08
Reporter: Miguel Angel Nieto Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.7.11 OS:Any
Assigned to: CPU Architecture:Any

[14 Mar 2016 8:13] Miguel Angel Nieto
Description:
MySQL 5.7 includes a patch for GET_LOCK that changes its behaviour but also places a limit on the identificator name that didn't exist before. In my personal opinion, that limitation could be removed.

How to repeat:
5.6

> select GET_LOCK(repeat('x', 195), 1);
+-------------------------------+
| GET_LOCK(repeat('x', 195), 1) |
+-------------------------------+
| 1 |
+-------------------------------+

5.7:

> select GET_LOCK(repeat('x', 195), 1);
ERROR 1059 (42000): Identifier name 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' is too long

Suggested fix:
Remove the limitation.
[14 Mar 2016 11:23] Morgan Tocker
The new implementation is based on MDL, and thus has the same maximum length of table names.  A workaround is to hash the lock-name using a function like SHA1.  Here is an example:
http://mysqlserverteam.com/making-get_lock-behavior-more-predictable-cross-version-with-qu...
[14 Mar 2016 14:08] MySQL Verification Team
Hello Miguel,

Thank you for the bug report and feedback.
As Morgan explained(with possible workaround), this is a documented behavior i.e MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.

Please see http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock

and some more details are here - https://dev.mysql.com/doc/refman/5.7/en/upgrading-from-previous-series.html

Thanks,
Umesh