orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Concurrent creation of EDGEs fails with OConcurrentModificationException

Open suneelkumarch opened this issue 2 years ago • 3 comments

OrientDB Version: 3.2.18

Java Version:

OS: Linux, runtime: Docker

Expected behavior

If we try creating EDGEs concurrently and associating the same Vertex, it fails with following error com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record #13:28776 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v26 your=v25)

I tried updating the orientdb-server-config.xml with the following configuration, but no luck :( <entry name="sql.graphConsistencyMode" value="notx_sync_repair"/> <entry value="-1" name="ridBag.sbtreeBonsaiToEmbeddedToThreshold"/> <entry value="2147483647" name="ridBag.sbtreeBonsaiToEmbeddedToThreshold"/>

suneelkumarch avatar Apr 26 '23 09:04 suneelkumarch

Hi,

This is a bit strange, do you have an example of the code you are using for this operation ?

As well are you doing this in a single transaction or with multiple transactions ?

Bye

tglman avatar Apr 26 '23 12:04 tglman

CREATE EDGE reference from (select from object_model where s_Id = '<from-id>' and s_model = '<from-model>') TO (select from object_model where s_Id = '<to-id>' and s_model = '<to-model>')"

Above SQL query is used to create EDGE. Multiples of these queries executed in parallel, with "from-id" and "from-model" being same and varying "to-id" and "to-model".

Usually, every time when a edge is create, associated VERTEX version is updated. However, to skip this behavior I suppose sbtreeBonsaiToEmbeddedToThreshold to -1, but this does not seem to work!

Am I missing something?

suneelkumarch avatar Apr 26 '23 13:04 suneelkumarch

Hi,

the sbtreeBonsaiToEmbeddedToThreshold tell engine make use a data structure "conflict free" for keeping the rids, but the first time a new "kind of edge" for a specific vertex is created, that can still cause a conflict, so is suggested to catch the concurrent modification exception and retry.

Regards

tglman avatar Apr 27 '23 17:04 tglman