Search in sources :

Example 21 with MembershipEntry

use of org.neo4j.causalclustering.core.consensus.membership.MembershipEntry in project neo4j by neo4j.

the class CoreBootstrapper method bootstrap.

public CoreSnapshot bootstrap(Set<MemberId> members) throws IOException {
    StoreFactory factory = new StoreFactory(storeDir, config, new DefaultIdGeneratorFactory(fs), pageCache, fs, logProvider);
    NeoStores neoStores = factory.openAllNeoStores(true);
    neoStores.close();
    CoreSnapshot coreSnapshot = new CoreSnapshot(FIRST_INDEX, FIRST_TERM);
    coreSnapshot.add(CoreStateType.ID_ALLOCATION, deriveIdAllocationState(storeDir));
    coreSnapshot.add(CoreStateType.LOCK_TOKEN, new ReplicatedLockTokenState());
    coreSnapshot.add(CoreStateType.RAFT_CORE_STATE, new RaftCoreState(new MembershipEntry(FIRST_INDEX, members)));
    coreSnapshot.add(CoreStateType.SESSION_TRACKER, new GlobalSessionTrackerState());
    appendNullTransactionLogEntryToSetRaftIndexToMinusOne();
    return coreSnapshot;
}
Also used : CoreSnapshot(org.neo4j.causalclustering.core.state.snapshot.CoreSnapshot) MembershipEntry(org.neo4j.causalclustering.core.consensus.membership.MembershipEntry) RaftCoreState(org.neo4j.causalclustering.core.state.snapshot.RaftCoreState) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) ReplicatedLockTokenState(org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenState) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) GlobalSessionTrackerState(org.neo4j.causalclustering.core.replication.session.GlobalSessionTrackerState)

Aggregations

MembershipEntry (org.neo4j.causalclustering.core.consensus.membership.MembershipEntry)21 RaftCoreState (org.neo4j.causalclustering.core.state.snapshot.RaftCoreState)21 Test (org.junit.Test)18 ControlledRenewableTimeoutService (org.neo4j.causalclustering.core.consensus.schedule.ControlledRenewableTimeoutService)17 FakeClock (org.neo4j.time.FakeClock)16 RaftMachine (org.neo4j.causalclustering.core.consensus.RaftMachine)3 RaftMachineBuilder (org.neo4j.causalclustering.core.consensus.RaftMachineBuilder)3 TestMessageBuilders.voteRequest (org.neo4j.causalclustering.core.consensus.TestMessageBuilders.voteRequest)3 RaftMessages (org.neo4j.causalclustering.core.consensus.RaftMessages)2 RaftLogEntry (org.neo4j.causalclustering.core.consensus.log.RaftLogEntry)2 MemberIdSet (org.neo4j.causalclustering.core.consensus.membership.MemberIdSet)2 MemberId (org.neo4j.causalclustering.identity.MemberId)2 Request (org.neo4j.causalclustering.core.consensus.RaftMessages.NewEntry.Request)1 TestMessageBuilders.appendEntriesRequest (org.neo4j.causalclustering.core.consensus.TestMessageBuilders.appendEntriesRequest)1 InMemoryRaftLog (org.neo4j.causalclustering.core.consensus.log.InMemoryRaftLog)1 GlobalSessionTrackerState (org.neo4j.causalclustering.core.replication.session.GlobalSessionTrackerState)1 ReplicatedLockTokenState (org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenState)1 CoreSnapshot (org.neo4j.causalclustering.core.state.snapshot.CoreSnapshot)1 Inbound (org.neo4j.causalclustering.messaging.Inbound)1 NeoStores (org.neo4j.kernel.impl.store.NeoStores)1