Re: GET_LOCK in ndb clusters
Hi Pete,
The cluster will serialise transactions using exclusive locks on the same [set of] primary key [ s ].
INSERT, UPDATE, DELETE all take exclusive locks on affected rows and so will serialise with each other.
SELECT ... FOR UPDATE takes exclusive locks and so will serialise with other SELECTs, or INSERT, UPDATE, DELETE.
You can use these properties to e.g. create a table of named locks, with the name as primary key, and other lock info as data. The existence of a row with a given name implies that the named resource is locked.
Looking at the locking functions description, the things that would be missing would be :
- Arbitrary claim timeout (can implement with retries, to some granularity)
- Recursive locking
- Deadlock detection
- Automatic cleanup on session termination
- Client session id associated data - not so useful across MySQLDs
Considering the cluster context, there should also be consideration given to :
- Handling MySQLD failure - cleanup of locks owned by (clients of the) failed MySQLD
- Handling cluster disconnect - invalidation of claimed locks on disconnected MySQLD
Probably it would make sense to define some stored procedures to encapsulate the ways in which such a service would be used.
Implementing a fully general system is harder than something more specific, so perhaps you can build what you need from what is already available.
Frazer
Edited 1 time(s). Last edit at 10/20/2021 04:02AM by Frazer Clement.
Subject
Views
Written By
Posted
1135
October 19, 2021 08:23AM
503
October 19, 2021 01:16PM
518
October 19, 2021 03:06PM
557
October 19, 2021 05:20PM
451
October 19, 2021 07:07PM
480
October 20, 2021 09:40AM
454
October 19, 2021 06:09PM
451
October 20, 2021 06:24AM
505
October 20, 2021 06:45AM
457
October 20, 2021 08:19AM
461
October 20, 2021 08:56AM
Re: GET_LOCK in ndb clusters
466
October 20, 2021 04:01AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.