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.
Java Version: openjdk version "11.0.5-ea" 2019-10-15
OS: Ubuntu 19.10
Expected behavior
Using the Orient Graph API in transactional mode, when setting properties to a new vertex after a failed commit, the new properties should be setted so we can retry the commit.
Actual behavior
The setProperties method of the vertex fails with a ORecordNotFoundException: The record with id '#-1:-2' was not found.
Steps to reproduce
Having this schema:
create class Test extends V;
create property Test.text string;
create index text_unique on Test(text) unique;
Run the following code:
OrientGraph g = factory.getTx();
var props = new HashMap<String, Object>(); props.put("text", "text1");
OrientVertex v1 = g.addVertex("class:Test", props);
g.commit();
System.out.println("RID: " + v1.getIdentity());
OrientVertex v2 = g.addVertex("class:Test", props);
try {
g.commit();
} catch (ORecordDuplicatedException ex) {
//"text1" is already used, change to other value:
props.put("text", "text2");
v2.setProperties(props); //this line throws the exception
g.commit();
}
The stacktrace is:
com.orientechnologies.orient.core.exception.ORecordNotFoundException: The record with id '#-1:-2' was not found
DB name="test"
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract.reload(ODatabaseDocumentAbstract.java:1174)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract.reload(ODatabaseDocumentAbstract.java:86)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.reload(ODatabaseDocumentTx.java:605)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.reload(ODatabaseDocumentTx.java:67)
at com.orientechnologies.orient.core.record.ORecordAbstract.reload(ORecordAbstract.java:260)
at com.orientechnologies.orient.core.record.ORecordAbstract.reload(ORecordAbstract.java:251)
at com.orientechnologies.orient.core.record.impl.ODocument.reload(ODocument.java:1019)
at com.orientechnologies.orient.core.record.impl.ODocument.reload(ODocument.java:118)
at com.orientechnologies.orient.core.record.ORecordAbstract.checkForLoading(ORecordAbstract.java:510)
at com.orientechnologies.orient.core.record.impl.ODocument.field(ODocument.java:1432)
at com.orientechnologies.orient.core.record.impl.ODocument.field(ODocument.java:1285)
at com.tinkerpop.blueprints.impls.orient.OrientElement.setPropertyInternal(OrientElement.java:640)
at com.tinkerpop.blueprints.impls.orient.OrientElement.setPropertiesInternal(OrientElement.java:691)
at com.tinkerpop.blueprints.impls.orient.OrientElement.setProperties(OrientElement.java:170)
OrientDB Version: 3.0.25
Java Version: openjdk version "11.0.5-ea" 2019-10-15
OS: Ubuntu 19.10
Expected behavior
Using the Orient Graph API in transactional mode, when setting properties to a new vertex after a failed commit, the new properties should be setted so we can retry the commit.
Actual behavior
The setProperties method of the vertex fails with a ORecordNotFoundException: The record with id '#-1:-2' was not found.
Steps to reproduce
Having this schema:
Run the following code:
The stacktrace is: