I'm running into exceptions where my transactions fail to commit, even though they're read-only cypher queries. I created a small test database that's attached to some software I've written (running embedded DB). I'm attaching messages.log for a lot of diagnostics. I ran some simple stub code to populate the test database, then do some querying on it using methods I wrote.
I'm hoping to find some help with why this is happening. I can actually
safely ignore these transaction exceptions, and nothing seems to go
horribly wrong, but they just shouldn't be there and I don't want to ignore
them as my strategy. Below I'm providing what the exceptions look like,
and the code of the method that's creating these exceptions. In other
parts of my code base I have other similar queries (always read-only cypher
queries wrapped in transactions) that have the same problems. I ran this
stub to try to illustrate the problem in one specific compact way.
The exception dumps --
SEVERE: Failed transaction: Unable to commit transaction
org.neo4j.graphdb.TransactionFailureException: Unable to commit transaction
at
org.neo4j.kernel.TopLevelTransaction.close(TopLevelTransaction.java:134)
at
org.mitre.provenance.db.neo4j.Neo4JStorage.getMembers(Neo4JStorage.java:545)
at org.mitre.provenance.test.Stub.main(Stub.java:17)
Caused by: javax.transaction.RollbackException: Failed to commit,
transaction rolled back
at
org.neo4j.kernel.impl.transaction.TxManager.rollbackCommit(TxManager.java:623)
at
org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:402)
at
org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:122)
at
org.neo4j.kernel.TopLevelTransaction.close(TopLevelTransaction.java:124)
The code that's throwing the exception:
public static ProvenanceCollection getMembers(PLUSWorkflow wf, User
user, int maximum) {
ViewedCollection d = new ViewedCollection(user);
if(db == null) initialize();
if(maximum <= 0 || maximum > Neo4JPLUSObjectFactory.MAX_OBJECTS)
maximum = 100;
Map<String,Object>params = new HashMap<String,Object>();
params.put("wf", wf.getId());
String query = "start
r=relationship:relationship_auto_index(workflow={wf}) " +
"return r " +
"limit " + maximum;
try (Transaction tx = db.beginTx()) {
ResourceIterator<Relationship> rs = Neo4JStorage.execute(query,
params).columnAs("r");
try {
while(rs.hasNext()) {
Relationship r = rs.next();
d.addNode(Neo4JPLUSObjectFactory.newObject(r.getStartNode()));
d.addNode(Neo4JPLUSObjectFactory.newObject(r.getEndNode()));
d.addEdge(Neo4JPLUSObjectFactory.newEdge(r));
}
} catch(PLUSException exc) {
exc.printStackTrace();
}
rs.close();
tx.success();
} catch(TransactionFailureException exc) {
log.severe("Failed transaction: " + exc.getMessage());
exc.printStackTrace();
}
return d;
} // End getMembers
Another relevant method (Neo4JStorage.execute): (db is a
GraphDatabaseService)
public static ExecutionResult execute(String cypherQuery,
Map<String,Object>params) {
if(db == null) initialize();
ExecutionEngine engine = new ExecutionEngine(db);
assert(db.index().getNodeAutoIndexer().isEnabled());
StringBuffer sb = new StringBuffer("");
for(String k : params.keySet()) sb.append(" " + k + "=" +
params.get(k));
//log.info("EXECUTING: " + cypherQuery + " /" +sb);
return engine.execute(cypherQuery + " ", params);
}
--
You received this message because you are subscribed to the Google Groups
"Neo4j" 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/groups/opt_out.
messages.log
Description: Binary data
