Re: GET_LOCK in ndb clusters
Thanks Frazer for the reply.
We did (also) implement some simple "user-defined" lock/lease concepts in a regular table that has as a primary key the id of the "named lock", and it's good to hear that the insert/update/delete will serialize properly. (We just also liked some of the features of GET_LOCK in some other areas... the user-defined lock/lease concept is not as powerful.)
I just want to be doubly sure about what the below guidance from Mikael means
----
locks in NDB is currently best performed on application level using a row
per table to be lockable and ensuring that all applications start
by either performing LOCK IN READ MODE to get a shared lock or
LOCK IN EXCLUSIVE MODE to get an exclusive lock on the table.
----
So, if I have a table like this:
----
mysql> describe object_lock;
+------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+-------+
| id | varchar(500) | NO | PRI | NULL | |
| requestId | varchar(255) | YES | | NULL | |
| startTime | datetime | YES | | NULL | |
| updateTime | datetime | YES | | NULL | |
| idleSecondsLimit | int | YES | | NULL | |
----
and just do normal
"INSERT INTO object_lock ..."
"UPDATE object_lock ... where id = ..."
"DELETE FROM object_lock .. where id = ..."
Then the ndb storage engine will take exclusive locks on the affected rows and the behaviors will be as expected even with clients operating simultaneously across the ndb cluster attached to multiple mysqld processes.
I just want to be sure about where the LOCK IN READ MODE and LOCK IN EXCLUSIVE MODE Mikael mentioned factors in... because we're presently not specifying these.
Thanks Frazer and Mikael,
Pete
p.s. - I just cannot seem to reply to the correct reply... forgive the incorrect reply-nesting. :-)
Edited 1 time(s). Last edit at 10/20/2021 06:47AM by Pete Ditmars.
Subject
Views
Written By
Posted
1185
October 19, 2021 08:23AM
521
October 19, 2021 01:16PM
543
October 19, 2021 03:06PM
576
October 19, 2021 05:20PM
468
October 19, 2021 07:07PM
497
October 20, 2021 09:40AM
470
October 19, 2021 06:09PM
471
October 20, 2021 06:24AM
Re: GET_LOCK in ndb clusters
528
October 20, 2021 06:45AM
475
October 20, 2021 08:19AM
487
October 20, 2021 08:56AM
491
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.