help on com.orientechnologies.orient.core.exception.OConcurrentModificationException error

411 views
Skip to first unread message

Yanxin

unread,
Jun 17, 2012, 3:02:00 AM6/17/12
to orient-...@googlegroups.com
Hello,
I have a program to insert record into OrientDB, which use timestamp as input parameters.
Originallly when I run the program, it will stops in the middle and report "com.orientechnologies.orient.core.exception.OConcurrentModificationException" error.
I google it and find the solution, which disable level1 cache and mvcc. This solve my problem.
For example,
java -Dcache.level1.enabled=false -Ddb.mvcc=false UpdateGraph 2012-06-01 2012-0614

I have run it for a week without the problem.

However, I have another question now. I need to run the program to update graph in different days at the same time so that I can speed up my progress, for example, I need to run
java -Dcache.level1.enabled=false -Ddb.mvcc=false UpdateGraph 2012-06-13 2012-0614
java -Dcache.level1.enabled=false -Ddb.mvcc=false UpdateGraph 2012-06-14 2012-0615

at the same time. The issue is when I start second process, the first one terminated with the same error as before "com.orientechnologies.orient.core.exception.OConcurrentModificationException".

Could anyone help me to solve the issue?
Thanks a lot.
Yanxin


Exception in thread "main" com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot update record #14:69 in storage 'graph' because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v81 your=v80)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:411)
        at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handleStatus(OChannelBinary.java:364)
        at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:145)
        at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:60)
        at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1492)
        at com.orientechnologies.orient.client.remote.OStorageRemote.updateRecord(OStorageRemote.java:445)
        at com.orientechnologies.orient.client.remote.OStorageRemoteThread.updateRecord(OStorageRemoteThread.java:151)
        at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.save(ODatabaseRaw.java:243)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeSaveRecord(ODatabaseRecordAbstract.java:662)
        at com.orientechnologies.orient.core.tx.OTransactionNoTx.saveRecord(OTransactionNoTx.java:72)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:221)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:214)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:35)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.linkToStream(ORecordSerializerCSVAbstract.java:739)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.fieldToStream(ORecordSerializerCSVAbstract.java:246)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerSchemaAware2CSV.toString(ORecordSerializerSchemaAware2CSV.java:242)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract.toStream(ORecordSerializerStringAbstract.java:80)
        at com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.toStream(ORecordSchemaAwareAbstract.java:118)
        at com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.toStream(ORecordSchemaAwareAbstract.java:113)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeSaveRecord(ODatabaseRecordAbstract.java:616)
        at com.orientechnologies.orient.core.tx.OTransactionNoTx.saveRecord(OTransactionNoTx.java:72)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:221)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:214)
        at com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:35)
        at com.orientechnologies.orient.core.record.ORecordAbstract.save(ORecordAbstract.java:269)
        at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1233)
        at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1222)
        at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:69)
        at com.orientechnologies.orient.core.type.tree.OMVRBTreeRID.saveAllNewEntries(OMVRBTreeRID.java:364)
        at com.orientechnologies.orient.core.type.tree.OMVRBTreeRID.commitChanges(OMVRBTreeRID.java:307)
        at com.orientechnologies.orient.core.type.tree.OMVRBTreePersistent.put(OMVRBTreePersistent.java:474)
        at com.orientechnologies.orient.core.type.tree.OMVRBTreeRIDSet.add(OMVRBTreeRIDSet.java:109)
        at com.orientechnologies.orient.core.db.graph.OGraphDatabase.createEdge(OGraphDatabase.java:275)
        at com.orientechnologies.orient.core.db.graph.OGraphDatabase.createEdge(OGraphDatabase.java:244)

Luca Garulli

unread,
Jun 18, 2012, 4:46:23 AM6/18/12
to orient-...@googlegroups.com
Hi,
you should disable the mvcc in the server side too. However usually disabling mvcc is not a good solution because you could update not last version loosing changes.

On high concurrency scenario the best is:
  1. disable level2 cache on clients (in the 1.1 or 1.2 we'll have a distributed level2 cache)
  2. force reloading of vertexes in case of concurrency exception. Example:
// 10 is the max retry here
for( int i = 0; i < 10; ++i ){
  try{
    // APPLY YOUR CHANGES
    db.createEdge( v1, v2 );
  } catch( OConcurrentModificationException e ){
    // RELOAD VERTEXES
    v1.reload();
    v2.reload();
  }
}

Lvc@

Yanxin

unread,
Jun 18, 2012, 2:44:04 PM6/18/12
to orient-...@googlegroups.com
Thank you so much, Luca.
Several questions:)
1) What is the purpose of cache level 1 and level 2?
2) should I enable mvcc when I run my java program?

Luca Garulli

unread,
Jun 18, 2012, 2:49:31 PM6/18/12
to orient-...@googlegroups.com
Hi,
2) usually yes: if the mvcc breaks means you could work on old records

Lvc@

刘志强

unread,
Oct 26, 2016, 5:43:35 AM10/26/16
to OrientDB
Hi Luca,

Could you please clarify more details for Caching, including the difference between Level 1 and Level 2 cache? I read the http://orientdb.com/docs/last/Caching.html, and found it is not clear to describe the several cache mechanisms in OrientDB, but I found another wiki @ https://github.com/sslavic/orientdb-wiki/blob/master/Caching.md, it told me more about caching, but I don't know it is workable for the latest OrientDB version, such as 2.2.xx, because I am investigating the CME issues in OrientDB 2.2.12.  

Thank you very much,

Zhiqiang
Reply all
Reply to author
Forward
0 new messages