Reputation: 995
We have a cypher as follows:
START n=node:ACCOUNTS(ACCOUNT_ID={id})
MATCH (n)-[:PROVIDER]->(p)<-[r:ALERT]-(m)
RETURN p.ID as pID, p.FIRST_NAME? as pFN, p.LAST_NAME? as pLN, count(r) as alerts
This works fine all the time even under heavy load. However we sometimes delete relationships in separate threads(within a transaction).
With extreme bad timing, we are getting this error:
******Relationship 13407007 not found
org.neo4j.graphdb.NotFoundException: Relationship 13407007 not found
at org.neo4j.kernel.impl.core.NodeManager.__AW_getRelationshipForProxy(NodeManager.java:675)
at org.neo4j.kernel.impl.core.NodeManager.getRelationshipForProxy(NodeManager.java)
at org.neo4j.kernel.InternalAbstractGraphDatabase$5.lookupRelationship(InternalAbstractGraphDatabase.java:689)
at org.neo4j.kernel.impl.core.RelationshipProxy.getOtherNode(RelationshipProxy.java:73)
at org.neo4j.cypher.internal.pipes.matching.FilteringIterable$FilteringIterator.spoolToNextInLine(FilteringIterable.scala:58)
at org.neo4j.cypher.internal.pipes.matching.FilteringIterable$FilteringIterator.next(FilteringIterable.scala:49)
at org.neo4j.cypher.internal.pipes.matching.FilteringIterable$FilteringIterator.next(FilteringIterable.scala:35)
at scala.collection.convert.Wrappers$IteratorWrapper.next(Wrappers.scala:30)
at org.neo4j.kernel.impl.traversal.TraversalBranchImpl.__AW_next(TraversalBranchImpl.java:137)
at org.neo4j.kernel.impl.traversal.TraversalBranchImpl.next(TraversalBranchImpl.java)
at org.neo4j.kernel.impl.traversal.TraversalBranchWithState.next(TraversalBranchWithState.java:32)
at org.neo4j.kernel.PreorderDepthFirstSelector.__AW_next(PreorderDepthFirstSelector.java:52)
at org.neo4j.kernel.PreorderDepthFirstSelector.next(PreorderDepthFirstSelector.java)
at org.neo4j.kernel.impl.traversal.TraverserIterator.fetchNextOrNull(TraverserIterator.java:65)
at org.neo4j.kernel.impl.traversal.TraverserIterator.fetchNextOrNull(TraverserIterator.java:34)
at org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:55)
at scala.collection.convert.Wrappers$JIteratorWrapper.hasNext(Wrappers.scala:41)
at scala.collection.Iterator$$anon$13.__AW_hasNext(Iterator.scala:371)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala)
at scala.collection.Iterator$$anon$13.__AW_hasNext(Iterator.scala:371)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
at scala.collection.Iterator$class.__AW_foreach(Iterator.scala:727)
at scala.collection.Iterator$class.foreach(Iterator.scala)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
at org.neo4j.cypher.internal.pipes.EagerAggregationPipe.internalCreateResults(EagerAggregationPipe.scala:76)
at org.neo4j.cypher.internal.pipes.PipeWithSource.createResults(Pipe.scala:69)
at org.neo4j.cypher.internal.pipes.PipeWithSource.createResults(Pipe.scala:66)
at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.org$neo4j$cypher$internal$executionplan$ExecutionPlanImpl$$prepareStateAndResult(ExecutionPlanImpl
.scala:164)
at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$getLazyReadonlyQuery$1.apply(ExecutionPlanImpl.scala:139)
at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$getLazyReadonlyQuery$1.apply(ExecutionPlanImpl.scala:138)
at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.execute(ExecutionPlanImpl.scala:38)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:72)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:76)
at org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:79)
We don't start a transaction for the cypher execution. Please advice on what could be causing this and a fix. This is with Neo4j Community 1.9.3
Upvotes: 0
Views: 832
Reputation: 995
Background: Cypher is not taking read locks, this might be fixed in v2.1
The tried and tested solution: catch NotFoundexception, sleep and retry the query
Another solution: (not sure if its really a solution- we are testing further): wrap the method inside a transaction
Upvotes: 1