orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.75k stars 871 forks source link

Getting exeption: com.orientechnologies.orient.core.exception.OConcurrentModificationException when running Orient DB 2.0.14-SNAPSHOT and database 1.7.x #4717

Closed shlapkov closed 9 years ago

shlapkov commented 9 years ago
jvm 1    | ERROR [ONetworkProtocolBinary] Sent run-time exception to the client /127.0.0.1:54394: co
m.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record
 #47:4189 because the version is not the latest. Probably you are updating an old record or it has b
een modified by another user (db=v34 your=v33)
jvm 1    | com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDA
TE the record #47:4189 because the version is not the latest. Probably you are updating an old recor
d or it has been modified by another user (db=v34 your=v33)
jvm 1    |      at com.orientechnologies.orient.core.conflict.OVersionRecordConflictStrategy.checkVe
rsions(OVersionRecordConflictStrategy.java:55) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.conflict.OVersionRecordConflictStrategy.onUpdat
e(OVersionRecordConflictStrategy.java:42) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.ch
eckAndIncrementVersion(OAbstractPaginatedStorage.java:1887) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.
14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.do
UpdateRecord(OAbstractPaginatedStorage.java:1552) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHO
T]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.up
dateRecord(OAbstractPaginatedStorage.java:710) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.server.distributed.ODistributedStorage.updateRecord(
ODistributedStorage.java:596) ~[orientdb-server-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeSaveReco
rd(ODatabaseDocumentTx.java:1757) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.tx.OTransactionOptimistic.addRecord(OTransactio
nOptimistic.java:312) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.tx.OTransactionOptimistic.saveRecord(OTransacti
onOptimistic.java:253) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseD
ocumentTx.java:2316) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseD
ocumentTx.java:2213) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseD
ocumentTx.java:118) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordS
erializerCSVAbstract.linkToStream(ORecordSerializerCSVAbstract.java:137) ~[orientdb-core-2.0.14-SNAP
SHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordS
erializerCSVAbstract.fieldToStream(ORecordSerializerCSVAbstract.java:364) ~[orientdb-core-2.0.14-SNA
PSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordS
erializerSchemaAware2CSV.toString(ORecordSerializerSchemaAware2CSV.java:506) ~[orientdb-core-2.0.14-
SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordS
erializerStringAbstract.toStream(ORecordSerializerStringAbstract.java:688) ~[orientdb-core-2.0.14-SN
APSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordS
erializerSchemaAware2CSV.toStream(ORecordSerializerSchemaAware2CSV.java:268) ~[orientdb-core-2.0.14-
SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.record.impl.ODocument.toStream(ODocument.java:2
100) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.record.impl.ODocument.toStream(ODocument.java:6
95) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.co
mmitEntry(OAbstractPaginatedStorage.java:1965) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.co
mmit(OAbstractPaginatedStorage.java:919) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.server.distributed.ODistributedStorage.commit(ODistr
ibutedStorage.java:828) ~[orientdb-server-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransaction
Optimistic.java:488) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOp
timistic.java:147) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabas
eDocumentTx.java:2437) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabas
eDocumentTx.java:2407) ~[orientdb-core-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.server.distributed.task.OTxTask.execute(OTxTask.java
:116) ~[orientdb-server-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.executeOnLocalNode
(OHazelcastPlugin.java:761) ~[orientdb-distributed-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.server.hazelcast.ODistributedWorker.onMessage(ODistr
ibutedWorker.java:298) ~[orientdb-distributed-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jvm 1    |      at com.orientechnologies.orient.server.hazelcast.ODistributedWorker.run(ODistributed
Worker.java:121) ~[orientdb-distributed-2.0.14-SNAPSHOT.jar:2.0.14-SNAPSHOT]
jillray7 commented 9 years ago

@lvca Can you take a look at this? Is this related to your note here: http://www.prjhub.com/#/issues/4633

lvca commented 9 years ago

This seems the classic MVCC exception, why is it an issue?

shlapkov commented 9 years ago

Because it wasn't the case before.

lvca commented 9 years ago

Could you show us the code responsible of this exception? Did you implement the retry in case of concurrent modification exception?

shlapkov commented 9 years ago

It wasn't code any code changes in our applications for quite a while. I notice this issue after resent changes in 2.0.14-SNAPSHOT and database 1.7.x. Issue is consistent. You do have our test database.

jillray7 commented 9 years ago

@lvca Can you recreate?

lvca commented 9 years ago

@shlapkov I have your database, but this is about your code. Can I reproduce this with OrientDBCluster.java? Or last file you sent to me?

shlapkov commented 9 years ago

No i can't reproduce it with OrientDBCluster.java. The same code is working fine in stand alone mode but constantly generate exception in distributed mode. There is no concurrent modification in our application in that time one client updating one record.

lvca commented 9 years ago

I'd need a way to reproduce this. Please could you send me a test case? Look also at: http://orientdb.com/docs/last/Concurrency.html to see if you managed concurrency correctly (The optimistic approach of OrientDB is the same since the beginning)

shlapkov commented 9 years ago

I am trying to reproduce issue with test applications

shlapkov commented 9 years ago

Hello @lvca please run the following test app:

https://github.com/shlapkov/OrientIssues/blob/master/ConcurrentModify/OrientDBModify.java

config files in: https://github.com/shlapkov/OrientIssues/tree/master/ConcurrentModify

first run with command line: "create 0" run in stand alone mode: "execute 0 false" no issue run in distributed alone mode: "execute 0 true" notice exception.

lvca commented 9 years ago

Running your app I was able to reproduce your problem. Fixing it...

lvca commented 9 years ago

Fixed.

jillray7 commented 9 years ago

@shlapkov We really do appreciate all your work helping us to recreate this. It should be resolved now. Can you confirm that this is resolved in the 2.0.14 snapshot?

shlapkov commented 9 years ago

yes in 2.0.14 snapshot working fine.

jillray7 commented 9 years ago

@shlapkov Great! Thank you.