我有一個neo4j數據庫,其中有數百萬個節點,並且關係數目也一樣多。在運行一個正在向其中添加數據的程序時,JVM似乎崩潰了。當我後來試圖使用索引來查詢數據庫,它常開和檢索的一些節點,但在某些時候返回以下錯誤:服務器崩潰後恢復損壞的neo4j數據庫graphdb.NotFoundException
Exception in thread "main" org.neo4j.graphdb.NotFoundException: Node[20924] not found. This can be because someone else deleted this entity while we were trying to read properties from it, or because of concurrent modification of other properties on this entity. The problem should be temporary. at org.neo4j.kernel.impl.core.Primitive.ensureFullProperties(Primitive.java:601) at org.neo4j.kernel.impl.core.Primitive.ensureFullProperties(Primitive.java:579) at org.neo4j.kernel.impl.core.Primitive.hasProperty(Primitive.java:309) at org.neo4j.kernel.impl.core.NodeImpl.hasProperty(NodeImpl.java:53) at org.neo4j.kernel.impl.core.NodeProxy.hasProperty(NodeProxy.java:160) at org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.hasProperty(GDSBackedQueryContext.scala:66) at org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.hasProperty(GDSBackedQueryContext.scala:48) at org.neo4j.cypher.internal.commands.Has.isMatch(Predicate.scala:203) at org.neo4j.cypher.internal.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:30) at org.neo4j.cypher.internal.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:30) at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:390) at scala.collection.Iterator$class.foreach(Iterator.scala:727) 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:67) at org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:66) at querygraph.BasicStatsQueries.main(BasicStatsQueries.java:54) Caused by: org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: PropertyRecord[11853043] not in use at org.neo4j.kernel.impl.nioneo.store.PropertyStore.getRecord(PropertyStore.java:453) at org.neo4j.kernel.impl.nioneo.store.PropertyStore.getLightRecord(PropertyStore.java:306) at org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.getPropertyRecordChain(ReadTransaction.java:185) at org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.loadProperties(ReadTransaction.java:215) at org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.nodeLoadProperties(ReadTransaction.java:239) at org.neo4j.kernel.impl.persistence.PersistenceManager.loadNodeProperties(PersistenceManager.java:111) at org.neo4j.kernel.impl.core.NodeManager.loadProperties(NodeManager.java:833) at org.neo4j.kernel.impl.core.NodeImpl.loadProperties(NodeImpl.java:143) at org.neo4j.kernel.impl.core.Primitive.ensureFullProperties(Primitive.java:596) ... 23 more
世界上只有一個線程(至少,我開始)運行查詢,它全部是閱讀,而不是寫作。雖然例外聲稱它是暫時的,但每次嘗試查詢此索引時都會發生這種情況。因此,我認爲它與壞的關機有關。在執行代碼以防止這種情況發生之前,我之前已經強制關閉了數據庫,但是neo4j始終能夠恢復數據庫,儘管它需要一段時間。看起來這更糟糕。
當我手動打開索引並添加try-catch時,它開始爲索引中的每個節點返回上面列出的錯誤。這是否意味着所有這些節點都不存在或損壞?這意味着數據的重大(巨大)損失,因爲索引中應該有大約一百萬個節點。我能做些什麼來恢復數據庫?
我使用的是1.9.2,並希望升級爲使用標籤等,但我現在需要這個數據庫來進行一些時間關鍵的工作,並且現在沒有時間來改變任何重要的東西。
非常感謝您的幫助。
謝謝!我會試試這個,並將其標記爲答案。 JVM崩潰可能是由程序中使用neo4j引起的 - 不知道它是neo4j本身還是其他組件之一。我會發現是否可以讓你擁有數據庫,如果有的話,我會一起發送服務器日誌。 – bsg
我見過你要求在類似的情況下查看數據庫幾次,並且知道neo真的處於任何問題之上真是太好了 - 謝謝! – bsg
我可以假設你的意思是'for(Node n:GlobalGraphOperations.at(db).getAllNodes())? – bsg