知识库

集群: org.neo4j.kernel.impl.transaction.log.NoSuchTransactionException: 无法在任何逻辑日志中找到事务 1:找不到包含 1 的任何日志

在操作 因果集群 时,如果从之前是集群成员的服务器中删除“存储”(data/databases/graph.db),那么在启动该服务器时,我们将收到以下异常

java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory, /path/to/neo4j/data/databases/graph.db

	at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:209)
	at org.neo4j.causalclustering.core.CoreGraphDatabase.<init>(CoreGraphDatabase.java:49)
	at org.neo4j.causalclustering.discovery.CoreClusterMember.start(CoreClusterMember.java:149)
	at org.neo4j.causalclustering.scenarios.CoreReplicationIT.shouldReplicateTransactionsToCoreMembers(CoreReplicationIT.java:88)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.neo4j.test.rule.VerboseTimeout$VerboseFailOnTimeout$CallableStatement.call(VerboseTimeout.java:237)
	at org.neo4j.test.rule.VerboseTimeout$VerboseFailOnTimeout$CallableStatement.call(VerboseTimeout.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.causalclustering.core.state.CoreLife@2b63e070' was successfully initialized, but failed to start. Please see the attached cause exception "Unable to find transaction 1 in any of my logical logs: Couldn't find any log containing 1".
	at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
	at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
	at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:205)
	... 16 more
Caused by: java.lang.RuntimeException: org.neo4j.kernel.impl.transaction.log.NoSuchTransactionException: Unable to find transaction 1 in any of my logical logs: Couldn't find any log containing 1
	at org.neo4j.causalclustering.core.state.machines.tx.LastCommittedIndexFinder.getLastCommittedIndex(LastCommittedIndexFinder.java:67)
	at org.neo4j.causalclustering.core.state.machines.tx.RecoverConsensusLogIndex.findLastAppliedIndex(RecoverConsensusLogIndex.java:48)
	at org.neo4j.causalclustering.core.state.machines.CoreStateMachines.installCommitProcess(CoreStateMachines.java:138)
	at org.neo4j.causalclustering.core.state.CoreLife.start(CoreLife.java:82)
	at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434)
	... 18 more
Caused by: org.neo4j.kernel.impl.transaction.log.NoSuchTransactionException: Unable to find transaction 1 in any of my logical logs: Couldn't find any log containing 1
	at org.neo4j.kernel.impl.transaction.log.PhysicalLogicalTransactionStore$LogVersionLocator.getLogPosition(PhysicalLogicalTransactionStore.java:223)
	at org.neo4j.kernel.impl.transaction.log.PhysicalLogicalTransactionStore.getTransactions(PhysicalLogicalTransactionStore.java:83)
	at org.neo4j.causalclustering.core.state.machines.tx.LastCommittedIndexFinder.getLastCommittedIndex(LastCommittedIndexFinder.java:57)
	... 22 more

出现此异常是因为存储现在与集群状态不同步。

如果我们希望该服务器重新加入集群,我们需要将其从集群中解绑。我们可以通过执行以下命令来完成此操作

$ neo4j-admin unbind --database=graph.db

现在我们可以启动服务器,它将能够重新加入集群。