Neo4j 无法读取某些节点。引发 NotFoundException。损坏的数据库
Posted
技术标签:
【中文标题】Neo4j 无法读取某些节点。引发 NotFoundException。损坏的数据库【英文标题】:Neo4j cannot read certain nodes. Throws NotFoundException. Corrupt database 【发布时间】:2014-07-13 18:24:21 【问题描述】:中止导入过程后,我发现了一个损坏的数据库。读取带有特定标签的节点几乎总是会抛出错误:
"Unable to load one or more relationships from Node[160147]. This usually happens when relationships are deleted by someone else just as we are about to load them."
上述节点是一个有很多关系的超连接节点。我不能删除它,也不能删除它的关系(使用密码),因为它会引发相同的错误。这发生在 2.1.0 版本中,但是 ö 我已经更新到 2.1.2,但徒劳地希望问题能够得到解决。
我能否以某种方式从文件系统中删除该节点,或者我该如何挽救它?
下面的堆栈。
( [消息] => 无法从节点 [160147] 加载一个或多个关系。这通常发生在我们即将加载关系被其他人删除时。请再试一次。 [异常] => NotFoundException [全名] => org.neo4j.graphdb.NotFoundException [堆栈跟踪] => 数组 ( [0] => org.neo4j.kernel.impl.core.NodeImpl.loadMoreRelationshipsFromNodeManager(NodeImpl.java:481) [1] => org.neo4j.kernel.impl.core.NodeImpl.getMoreRelationships(NodeImpl.java:358) [2] => org.neo4j.kernel.impl.core.NodeImpl.loadInitialRelationships(NodeImpl.java:288) [3] => org.neo4j.kernel.impl.core.NodeImpl.ensureRelationshipMapNotNull(NodeImpl.java:260) [4] => org.neo4j.kernel.impl.core.NodeImpl.getAllRelationships(NodeImpl.java:151) [5] => org.neo4j.kernel.impl.core.NodeImpl.getRelationships(NodeImpl.java:235) [6] => org.neo4j.kernel.impl.api.store.PersistenceCache.nodeGetRelationships(PersistenceCache.java:205) [7] => org.neo4j.kernel.impl.api.store.CacheLayer.nodeListRelationships(CacheLayer.java:445) [8] => org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeGetRelationships(StateHandlingStatementOperations.java:992) [9] => org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.nodeGetRelationships(ConstraintEnforcingEntityOperations.java:364) [10] => org.neo4j.kernel.impl.api.OperationsFacade.nodeGetRelationships(OperationsFacade.java:182) [11] => org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:143) [12] => org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:76) [13] => org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext.getRelationshipsFor(TransactionBoundQueryContext.scala:112) [14] => org.neo4j.cypher.internal.compiler.v2_1.spi.DelegatingQueryContext.getRelationshipsFor(DelegatingQueryContext.scala:57) [15] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$$super$getRelationshipsFor(ExceptionTranslatingQueryContext.scala:59) [16] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$$anonfun$getRelationshipsFor$1.apply(ExceptionTranslatingQueryContext.scala:59) [17] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$$anonfun$getRelationshipsFor$1.apply(ExceptionTranslatingQueryContext.scala:59) [18] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQueryContext.scala:149) [19] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.getRelationshipsFor(ExceptionTranslatingQueryContext.scala:59) [20] => org.neo4j.cypher.internal.compiler.v2_1.spi.DelegatingQueryContext.getRelationshipsFor(DelegatingQueryContext.scala:57) [21] => org.neo4j.cypher.internal.compiler.v2_1.pipes.matching.SingleStep$$anonfun$1.apply(SingleStep.scala:44) [22] => org.neo4j.cypher.internal.compiler.v2_1.pipes.matching.SingleStep$$anonfun$1.apply(SingleStep.scala:43) [23] => org.neo4j.cypher.internal.helpers.DynamicIterable$$anon$1.iterator(DynamicIterable.scala:28) [24] => org.neo4j.cypher.internal.helpers.DynamicJavaIterable$$anon$3.iterator(DynamicIterable.scala:38) [25] => org.neo4j.kernel.impl.traversal.TraversalBranchWithState.expandRelationshipsWithoutChecks(TraversalBranchWithState.java:71) [26] => org.neo4j.kernel.impl.traversal.TraversalBranchImpl.expandRelationships(TraversalBranchImpl.java:104) [27] => org.neo4j.kernel.impl.traversal.StartNodeTraversalBranch.next(StartNodeTraversalBranch.java:47) [28] => org.neo4j.kernel.impl.traversal.AsOneStartBranch.next(AsOneStartBranch.java:100) [29] => org.neo4j.graphdb.traversal.PreorderDepthFirstSelector.next(PreorderDepthFirstSelector.java:49) [30] => org.neo4j.kernel.impl.traversal.MonoDirectionalTraverserIterator.fetchNextOrNull(MonoDirectionalTraverserIterator.java:68) [31] => org.neo4j.kernel.impl.traversal.MonoDirectionalTraverserIterator.fetchNextOrNull(MonoDirectionalTraverserIterator.java:35) [32] => org.neo4j.helpers.collection.PrefetchingIterator.peek(PrefetchingIterator.java:60) [33] => org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:46) [34] => scala.collection.convert.Wrappers$JIteratorWrapper.hasNext(Wrappers.scala:41) [35] => scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) [36] => scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) [37] => scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:388) [38] => scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) [39] => scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) [40] => scala.collection.Iterator$class.foreach(Iterator.scala:727) [41] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157) [42] => scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48) [43] => scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:176) [44] => scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45) [45] => scala.collection.TraversableOnce$class.to(TraversableOnce.scala:273) [46] => scala.collection.AbstractIterator.to(Iterator.scala:1157) [47] => scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:257) [48] => scala.collection.AbstractIterator.toList(Iterator.scala:1157) [49] => org.neo4j.cypher.internal.compiler.v2_1.pipes.LegacySortPipe.internalCreateResults(LegacySortPipe.scala:32) [50] => org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:98) [51] => org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:95) [52] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:119) [53] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:118) [54] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionWorkflowBuilder.runWithQueryState(ExecutionPlanBuilder.scala:169) [55] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:117) [56] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:102) [57] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:68) [58] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:67) [59] => org.neo4j.cypher.internal.ExecutionPlanWrapperForV2_1.execute(CypherCompiler.scala:126) [60] => org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:75) [61] => org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:69) [62] => org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:84) [63] => org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:114) [64] => java.lang.reflect.Method.invoke(Method.java:606) [65] => org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139) [66] => java.lang.Thread.run(Thread.java:724) ) [原因] => 数组 ( [消息] => 关系记录 [2121672] 未使用 [异常] => InvalidRecordException [堆栈跟踪] => 数组 ( [0] => org.neo4j.kernel.impl.nioneo.store.RelationshipStore.getRecord(RelationshipStore.java:267) [1] => org.neo4j.kernel.impl.nioneo.store.RelationshipStore.getChainRecord(RelationshipStore.java:337) [2] => org.neo4j.kernel.impl.nioneo.xa.NeoStoreTransaction.getMoreRelationships(NeoStoreTransaction.java:1522) [3] => org.neo4j.kernel.impl.nioneo.xa.NeoStoreTransaction.getMoreRelationships(NeoStoreTransaction.java:1101) [4] => org.neo4j.kernel.impl.persistence.PersistenceManager.getMoreRelationships(PersistenceManager.java:89) [5] => org.neo4j.kernel.impl.core.RelationshipLoader.getMoreRelationships(RelationshipLoader.java:52) [6] => org.neo4j.kernel.impl.core.NodeManager.getMoreRelationships(NodeManager.java:786) [7] => org.neo4j.kernel.impl.core.NodeImpl.loadMoreRelationshipsFromNodeManager(NodeImpl.java:477) [8] => org.neo4j.kernel.impl.core.NodeImpl.getMoreRelationships(NodeImpl.java:358) [9] => org.neo4j.kernel.impl.core.NodeImpl.loadInitialRelationships(NodeImpl.java:288) [10] => org.neo4j.kernel.impl.core.NodeImpl.ensureRelationshipMapNotNull(NodeImpl.java:260) [11] => org.neo4j.kernel.impl.core.NodeImpl.getAllRelationships(NodeImpl.java:151) [12] => org.neo4j.kernel.impl.core.NodeImpl.getRelationships(NodeImpl.java:235) [13] => org.neo4j.kernel.impl.api.store.PersistenceCache.nodeGetRelationships(PersistenceCache.java:205) [14] => org.neo4j.kernel.impl.api.store.CacheLayer.nodeListRelationships(CacheLayer.java:445) [15] => org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeGetRelationships(StateHandlingStatementOperations.java:992) [16] => org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.nodeGetRelationships(ConstraintEnforcingEntityOperations.java:364) [17] => org.neo4j.kernel.impl.api.OperationsFacade.nodeGetRelationships(OperationsFacade.java:182) [18] => org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:143) [19] => org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:76) [20] => org.neo4j.cypher.internal.spi.v2_1.TransactionBoundQueryContext.getRelationshipsFor(TransactionBoundQueryContext.scala:112) [21] => org.neo4j.cypher.internal.compiler.v2_1.spi.DelegatingQueryContext.getRelationshipsFor(DelegatingQueryContext.scala:57) [22] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$$super$getRelationshipsFor(ExceptionTranslatingQueryContext.scala:59) [23] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$$anonfun$getRelationshipsFor$1.apply(ExceptionTranslatingQueryContext.scala:59) [24] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext$$anonfun$getRelationshipsFor$1.apply(ExceptionTranslatingQueryContext.scala:59) [25] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compiler$v2_1$spi$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQueryContext.scala:149) [26] => org.neo4j.cypher.internal.compiler.v2_1.spi.ExceptionTranslatingQueryContext.getRelationshipsFor(ExceptionTranslatingQueryContext.scala:59) [27] => org.neo4j.cypher.internal.compiler.v2_1.spi.DelegatingQueryContext.getRelationshipsFor(DelegatingQueryContext.scala:57) [28] => org.neo4j.cypher.internal.compiler.v2_1.pipes.matching.SingleStep$$anonfun$1.apply(SingleStep.scala:44) [29] => org.neo4j.cypher.internal.compiler.v2_1.pipes.matching.SingleStep$$anonfun$1.apply(SingleStep.scala:43) [30] => org.neo4j.cypher.internal.helpers.DynamicIterable$$anon$1.iterator(DynamicIterable.scala:28) [31] => org.neo4j.cypher.internal.helpers.DynamicJavaIterable$$anon$3.iterator(DynamicIterable.scala:38) [32] => org.neo4j.kernel.impl.traversal.TraversalBranchWithState.expandRelationshipsWithoutChecks(TraversalBranchWithState.java:71) [33] => org.neo4j.kernel.impl.traversal.TraversalBranchImpl.expandRelationships(TraversalBranchImpl.java:104) [34] => org.neo4j.kernel.impl.traversal.StartNodeTraversalBranch.next(StartNodeTraversalBranch.java:47) [35] => org.neo4j.kernel.impl.traversal.AsOneStartBranch.next(AsOneStartBranch.java:100) [36] => org.neo4j.graphdb.traversal.PreorderDepthFirstSelector.next(PreorderDepthFirstSelector.java:49) [37] => org.neo4j.kernel.impl.traversal.MonoDirectionalTraverserIterator.fetchNextOrNull(MonoDirectionalTraverserIterator.java:68) [38] => org.neo4j.kernel.impl.traversal.MonoDirectionalTraverserIterator.fetchNextOrNull(MonoDirectionalTraverserIterator.java:35) [39] => org.neo4j.helpers.collection.PrefetchingIterator.peek(PrefetchingIterator.java:60) [40] => org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:46) [41] => scala.collection.convert.Wrappers$JIteratorWrapper.hasNext(Wrappers.scala:41) [42] => scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) [43] => scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) [44] => scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:388) [45] => scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) [46] => scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) [47] => scala.collection.Iterator$class.foreach(Iterator.scala:727) [48] => scala.collection.AbstractIterator.foreach(Iterator.scala:1157) [49] => scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48) [50] => scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:176) [51] => scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45) [52] => scala.collection.TraversableOnce$class.to(TraversableOnce.scala:273) [53] => scala.collection.AbstractIterator.to(Iterator.scala:1157) [54] => scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:257) [55] => scala.collection.AbstractIterator.toList(Iterator.scala:1157) [56] => org.neo4j.cypher.internal.compiler.v2_1.pipes.LegacySortPipe.internalCreateResults(LegacySortPipe.scala:32) [57] => org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:98) [58] => org.neo4j.cypher.internal.compiler.v2_1.pipes.PipeWithSource.createResults(Pipe.scala:95) [59] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:119) [60] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1$$anonfun$apply$2.apply(ExecutionPlanBuilder.scala:118) [61] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionWorkflowBuilder.runWithQueryState(ExecutionPlanBuilder.scala:169) [62] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:117) [63] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:102) [64] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:68) [65] => org.neo4j.cypher.internal.compiler.v2_1.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:67) [66] => org.neo4j.cypher.internal.ExecutionPlanWrapperForV2_1.execute(CypherCompiler.scala:126) [67] => org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:75) [68] => org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:69) [69] => org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:84) [70] => org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:114) [71] => java.lang.reflect.Method.invoke(Method.java:606) [72] => org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139) [73] => java.lang.Thread.run(Thread.java:724) ) [全名] => org.neo4j.kernel.impl.nioneo.store.InvalidRecordException ) )【问题讨论】:
【参考方案1】:要检查您的数据存储的一致性,请查看Mark's great blog post。
【讨论】:
【参考方案2】:您如何中止了什么样的导入过程?如果它是批量插入器,那么如果您中止它,则无法保证一致的存储,并且您可能会更安全地重做导入。
如果它是事务性的,则不应存在不一致。
另请注意,2.1.0 存在一些问题,不应该使用,因此您可能会遇到双重问题。
【讨论】:
我自己写了一个导入脚本,它通过按节点 id 匹配来进行大量导入,如下所示:“MATCH ... WHERE id(a) IN [1,2,3,4, 5,6] ...创建..."。 IN 语句有时可能包含 200-300 个节点 ID,所以我猜如果它被突然杀死,它可能会损坏我的数据库。 我们的一位客户报告了 Neo4j 2.1.4 的此错误,这是该版本的已知问题吗?以上是关于Neo4j 无法读取某些节点。引发 NotFoundException。损坏的数据库的主要内容,如果未能解决你的问题,请参考以下文章