由于错误的RID在提交时创建记录时发生OConcurrentcreateException

时间:2018-08-13 06:48:44

标签: orientdb

OrientDB版本:3.0.5 Java版本:1.8 操作系统:Debian

你好

在执行以下简单代码时,我遇到了与RID相关的系统错误:

orientdb = new OrientDB(dbUrl, dbUser,dbPassword, OrientDBConfig.defaultConfig());
session = orientdb.open(databaseName, dbUser, dbPassword);

session.begin();
OVertex v = session.newVertex("Folder");
v.setProperty("name", "RootFolder");
session.save(v);
session.commit();

我正在3个集群中的一台机器上执行一个代码,但是没有其他代码或用户与该集群交互。 我还阅读了有关乐观交易的信息,但在这里,100%的时间抛出了异常。 我认为例外是在触发 session.commit()

这是错误:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.orientechnologies.orient.core.exception.OConcurrentCreateException: Cannot create the record #17:4 because the assigned RID was #17:3 instead
    DB name="FDStest"
    DB name="FDStest"
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.throwSerializedException(OChannelBinaryAsynchClient.java:318)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:275)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:191)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:153)
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1779)
    at com.orientechnologies.orient.client.remote.OStorageRemote.lambda$networkOperationRetryTimeout$2(OStorageRemote.java:226)
    at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:285)
    at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationRetryTimeout(OStorageRemote.java:214)
    at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationNoRetry(OStorageRemote.java:239)
    at com.orientechnologies.orient.client.remote.OStorageRemote.commit(OStorageRemote.java:964)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract.internalCommit(ODatabaseDocumentAbstract.java:2733)
    at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:534)
    at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:100)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract.commit(ODatabaseDocumentAbstract.java:2221)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract.commit(ODatabaseDocumentAbstract.java:2191)
    at OrientDb.OrientST.OrientDBDataBaseGenerationToolCluster.<init>(OrientDBDataBaseGenerationToolCluster.java:60)
    at OrientDb.OrientST.App.main(App.java:21)
    ... 5 more

相关的部分是:

Cannot create the record #17:4 because the assigned RID was #17:3 instead

欢迎任何帮助。谢谢。

此外,当我尝试此代码时:

OVertex v = session.newVertex("Folder");
session.save(v);

手术有10%的机会成功。

1 个答案:

答案 0 :(得分:0)

原来执行如下TRUNCATE动作: 截断V级不安全 将永久破坏数据库中的RID。