Bug #105266 GET_LOCK does not work across ndb cluster
Submitted: 19 Oct 2021 23:17 Modified: 20 Oct 2021 0:07
Reporter: Pete Ditmars Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Documentation Severity:S3 (Non-critical)
Version:all OS:Any
Assigned to: CPU Architecture:Any

[19 Oct 2021 23:17] Pete Ditmars
Description:
The GET_LOCK mechanism does not work across an ndb cluster that utilizes multiple mysqld processes.  Each mysqld maintains its own named lock database.

People choose mysql ndb cluster as a clustering technology.  It's very non-intuitive that this would be a limitation of GET_LOCK.

Short term: 
1. The GET_LOCK documentation should be very, very clear that this is not supported.
2. The NDB limitations documentation should be very, very clear that this is not supported.

Longer term:
I think GET_LOCK, or something very similar, that worked across the NDB cluster would be well-received by mysql ndb cluster users.  

How to repeat:
set up an NDB cluster with > 1 mysqld processes participating
start mysql connecting to mysqld-process-1 and use "select GET_LOCK("mylock",1);"
start mysql connecting to mysqld-process-2 and use "select GET_LOCK("mylock",1);"

both GET_LOCKs will succeed

This query:

select * from performance_schema.metadata_locks;

on both mysqld-1 and mysqld-2 will return the lock named "mylock" and show that it is owned by a different session/connection/process/whatever.

Suggested fix:
1. fix the documentation, put this in huge red letters in GET_LOCK and ndb cluster limitations section

2. add something like GET_LOCK that works across an ndb cluster if you can't retrofit GET_LOCK to actually work across the ndb cluster
[20 Oct 2021 0:07] Jon Stephens
This is a documentation issue, which is fixed in mysqldoc rev 71138.

Thanks for the suggestion.