Hi,
I recently ran into an issue with concurrency. According to the
documentation, OrientDB supports ACID transactions. Let's consider the
following scenario:
OrientGraphFactory factory = ...; // initialize factory, load some
vertices into the graph
final String sqlQuery = ... ; // an arbitrary query returning vertices
(both threads use the same query)
// thread 1
Graph graph = factory.getTx();
Iterable<Vertex> vertices = (Iterable<Vertex>)graph.command(new OCommandSQL
(sqlQuery)).execute();
for(Vertex vertex : vertices){
// perform some work by reading the graph contents
vertex.getProperty("someproperty");
}
// thread 2
Graph graph = factory.getTx();
Iterable<Vertex> vertices = (Iterable<Vertex>)graph.command(new OCommandSQL
(sqlQuery)).execute();
// delete all the vertices
for(Vertex vertex : vertices){
vertex.remove();
}
graph.commit();
Let's further assume that thread1 is currently iterating over the result
set of the query while thread2 performs "graph.commit()". What happens now
is that thread1 will produce either a "NoSuchElementException" on
"iterator.next()", or a "NullPointerException" in
"vertex.getProperty(...)". This happens even though both transactions are
ACID - so thread1 should not even be aware of the fact that thread2 deleted
something in the database due to the isolation level. And even if it does -
I think it should not throw a generic exception, but some kind of
"OrientDBConcurrentModificationException" which can be caught and properly
handled in a try-catch block.
Did I miss out some configuration property regarding ACID? Or is this a
known issue and accepted as a fact? How should an application deal with
such issues?
Thank you,
Alan
--
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.