服务器崩溃后恢复损坏的neo4j数据库graphdb.NotFoundException



我有一个neo4j数据库,它有数百万个节点和大约同样多的关系。当运行一个向其中添加数据的程序时,JVM似乎崩溃了。当我后来尝试使用索引查询数据库时,它正常打开并检索了一些节点,但在某个时候返回了以下错误:

线程"main"org.neo4j.graphdb.NotFoundException异常:找不到节点[20924]。这可能是因为其他人删除了此实体,或者因为同时修改此实体上的其他属性。这个这个问题应该是暂时的。在org.neo4j.kernel.impl.core.Primitive.ensureFullProperties(Primitive.java:601)在org.neo4j.kernel.impl.core.Primitive.ensureFullProperties(Primitive.java:579)在org.neo4j.kernel.impl.core.Primitive.hasProperty(Primitive.java:309)网址:org.neo4j.kernel.impl.core.NodeImpl.hasProperty(NodeImpl.java:53)在org.neo4j.kernel.impl.core.NodeProxy.hasProperty(NodeProxy.java:160)在org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.hasProperty(GDSBacked QueryContext.scala:66)在org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.hasProperty(GDSBacked QueryContext.scala:48)在org.neo4j.cypher.internal.commands.Has.isMatch(谓词.scala:203)在org.neo4j.cypher.internal.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:30)在org.neo4j.cypher.internal.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:30)位于scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:390)位于的scala.collection.Iterator$class.foreach(Iterator.scala:727)scala.collection.AbstractIterator.foreach(Iterator.scala:1156)位于org.neo4j.cypher.internal.pipes.EagleAggregationPipe.internalCreateResults(EagleAggregatePipe.scala:76)在org.neo4j.cypher.internal.pipes.PipeWithSource.createResults(Pipe.scala:69)在org.neo4j.cypher.internal.pipes.PipeWithSource.createResults(Pipe.scala:66)在org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.org/neo4j$cypher$internal$executionplan$ExecutionPlanImpl$$prepareStateAndResult(ExecutionPlanImpl.scala:164)在org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$getLazyReadonlyQuery$1.apply(ExecutionPlanImpl.scala:139)在org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$getLazyReadonlyQuery$1.apply(ExecutionPlanImpl.scala:138)在org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.execute(ExecutionPlanImpl.scala:38)网址:org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:72)网址:org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:67)在org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:66)在querygraph中。BasicStatsQueries.main(BasicStatisQueries.java:54)由:org.neo4j.kernel.impl.nioneo.store.InvalidRecordException引起:处未使用PropertyRecord[11853043]org.neo4j.kernel.impl.nioneo.store.PropertyStore.getRecord(PropertyStore.java:453)在org.neo4j.kernel.impl.nioneo.store.PropertyStore.getLightRecord(PropertyStore.java:306)在org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.getPropertyRecordChain(ReadTransaction.java:185)在org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.loadProperties(ReadTransaction.java:215)在org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.nodeLoadProperties(ReadTransaction.java:239)在org.neo4j.kernel.impl.persistence.PersistenceManager.loadNodeProperties(PersistenceManager.java:111)在org.neo4j.kernel.impl.core.NodeManager.loadProperties(NodeManager.java:833)在org.neo4j.kernel.impl.core.NodeImpl.loadProperties(NodeImpl.java:143)在org.neo4j.kernel.impl.core.Primitive.ensureFullProperties(Primitive.java:596)…还有23个

只有一个线程(至少是我启动的)在运行查询,而且都是读取,而不是写入。尽管异常声称它是临时的,但每次我尝试查询该索引时都会发生这种情况。因此,我认为这与糟糕的关机有关。在实现代码之前,我曾因强制关闭而导致数据库损坏,但neo4j总是能够恢复数据库,尽管这需要一段时间。情况似乎更糟。

当我手动遍历索引并添加try-catch时,它开始为索引中上面列出的节点之后的每个节点返回错误。这是否意味着所有这些节点都不存在或已损坏?这将意味着数据的重大(巨大)损失,因为索引中应该有大约一百万个节点。如何恢复数据库?

我使用的是1.9.2,我很想升级到使用标签等,但我现在需要这个数据库来完成一些时间紧迫的工作,现在没有时间更改任何重大内容。

事先非常感谢您的帮助。

很抱歉发生在你身上。:(那是什么样的崩溃?

我建议备份数据库,然后删除并重新创建索引。

当您无法以编程方式删除索引时,您也可以删除下的目录数据库关闭时的/data/graph.db/index/lucene/node/<indexname>

然后,您可以使用以编程方式重新索引节点

for(节点n:GlobalGraphOperations.at(db).getAllNodes()){if(node.hasProperty("key"))db.index().forNodes("index").add(node,"key",node.getProperty("key"));}

如果你能为我们提供分析数据库,那就太好了。非常感谢

最新更新