Record version after conflict

410 Views Asked by At

I use Orientdb 2.2.35. I insert some documents into it until a conflict occurs. When I check the record version, it didn't change during the insertion (After conflict). In my example you can see the version of #18:0 after I insert an edge (create edge mye from #18:0 to #19:0)

Error:

com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record #18:0 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v2 your=v1)

orientdb {db=TestDB}> select * from #18:0

+----+-----+------+----+------------------------------------------------------------------------+
|#   |@RID |@CLASS|id  |out_MyE                                                                 |
+----+-----+------+----+------------------------------------------------------------------------+
|0   |#18:0|MyV   |1   |[#22:0,#22:1,#22:2,#22:3,#22:4,#22:5,#22:6,#22:7,#22:8,#22:9(size=5000)]|
+----+-----+------+----+------------------------------------------------------------------------+

1 item(s) found. Query executed in 0.002 sec(s).
orientdb {db=TestDB}> load record #18:0

DOCUMENT @class:MyV @rid:#18:0 @version:2
+----+-------+------------------------------------------------------------------------+
|#   |NAME   |VALUE                                                                   |
+----+-------+------------------------------------------------------------------------+
|0   |id     |1                                                                       |
|1   |out_MyE|[#22:0,#22:1,#22:2,#22:3,#22:4,#22:5,#22:6,#22:7,#22:8,#22:9(size=5000)]|
+----+-------+------------------------------------------------------------------------+

OK
orientdb {db=TestDB}> create edge mye from #18:0 to #19:0

+----+--------+------+-----+-----+
|#   |@RID    |@CLASS|out  |in   |
+----+--------+------+-----+-----+
|0   |#22:5250|MyE   |#18:0|#19:0|
+----+--------+------+-----+-----+
Created '1' edges in 0.017000 sec(s).

orientdb {db=TestDB}> select * from #18:0

+----+-----+------+----+------------------------------------------------------------------------+
|#   |@RID |@CLASS|id  |out_MyE                                                                 |
+----+-----+------+----+------------------------------------------------------------------------+
|0   |#18:0|MyV   |1   |[#22:0,#22:1,#22:2,#22:3,#22:4,#22:5,#22:6,#22:7,#22:8,#22:9(size=5001)]|
+----+-----+------+----+------------------------------------------------------------------------+

1 item(s) found. Query executed in 0.001 sec(s).
orientdb {db=TestDB}> load record #18:0

DOCUMENT @class:MyV @rid:#18:0 @version:2
+----+-------+------------------------------------------------------------------------+
|#   |NAME   |VALUE                                                                   |
+----+-------+------------------------------------------------------------------------+
|0   |id     |1                                                                       |
|1   |out_MyE|[#22:0,#22:1,#22:2,#22:3,#22:4,#22:5,#22:6,#22:7,#22:8,#22:9(size=5001)]|
+----+-------+------------------------------------------------------------------------+

OK
1

There are 1 best solutions below

1
dgiannotti On

This is a common issue caused by a wrong approach to concurrency or transactions. You're gonna need to troubleshoot the cause and either write fail-safe code or change your graph consistency level

OrientDB | Troubleshooting OConcurrentModificationException