I have two node.js processes running on separate servers that are doing UPDATES on the same class. The updates look like this (simplified here):
UPDATE test SET staged = true, tag = null RETURN AFTER @this WHERE (publish <= 100 AND staged = 99) LOCK RECORD
UPDATE test SET expires = 100, publish = 99 WHERE (@rid IN [...(list of RIDs)...]) LOCK RECORD
This works fine (and never generates an error with only one process running). But when both processes are running, I occasionally get: You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: OrientDB.RequestError: Cannot UPDATE the record #12:1942 because the version is not the latest. Probably you are updating an old record or it has been modified by another user.
I thought that adding
LOCK RECORD would prevent this? What is causing this concurrency error?
PS - This is ODB 2.2.29 and OJS 2.2.10.