Hi all!

I am in the process of debugging an application based on OrientDB (2.0M2). 
The problem I am facing are some OConcurrentModificationException. The 
issue appears with both the "memory" and the "plocal" storage engines (I 
did not try "remote"). It looks they are caused by the fact that multiple 
OrientVertex objects which refer to the same database record are (in 
general) not in sync. This also means that there is no guarantee in general 
that a value which is returned by a query is the most up to date.
The following code replicates the issue. I agree it may look a bit awkward, 
but it is just the smallest example I could come up with from our code.

OrientGraphFactory graphFactory = new OrientGraphFactory(DATABASE_URL);
graphFactory.setAutoStartTx(false);
OrientGraph graph = graphFactory.getTx();

graph.begin();
OrientVertex firstVertexHandle = graph.addVertex(null, PROPERTY_NAME, 0);
graph.commit();
firstVertexHandle.setProperty(PROPERTY_NAME, 1);

// Note that if any of the following 3 lines are commented, then the 
problem does not appear
graph.begin();
graph.getVertices("someproperty", "somevalue").iterator().hasNext();
graph.commit();
        
Object vertexId = firstVertexHandle.getId();

Vertex secondVertexHandle = graph.getVertex(vertexId);
secondVertexHandle.setProperty(PROPERTY_NAME, 2);

// prints 1
System.out.println(firstVertexHandle.getProperty(PROPERTY_NAME));
// prints 2
System.out.println("Value queried from the second vertex handle is " + 
secondVertexHandle.getProperty(PROPERTY_NAME));

// The following throws an OConcurrentModificationException
firstVertexHandle.setProperty(PROPERTY_NAME, 3);


Is this a bug in OrientDB?
What should the expected behavior with respect to multiple Vertex objects 
referring to the same database record?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to