public override void ApplyTo(InFlightCache inFlightCache, Log log) { for (int i = Offset; i < Entries.Length; i++) { inFlightCache.Put(BaseIndex + i, Entries[i]); } }
internal RaftLogShipper(Outbound <MemberId, Org.Neo4j.causalclustering.core.consensus.RaftMessages_RaftMessage> outbound, LogProvider logProvider, ReadableRaftLog raftLog, Clock clock, TimerService timerService, MemberId leader, MemberId follower, long leaderTerm, long leaderCommit, long retryTimeMillis, int catchupBatchSize, int maxAllowedShippingLag, InFlightCache inFlightCache) { this._outbound = outbound; this._timerService = timerService; this._catchupBatchSize = catchupBatchSize; this._maxAllowedShippingLag = maxAllowedShippingLag; this._log = logProvider.getLog(this.GetType()); this._raftLog = raftLog; this._clock = clock; this._follower = follower; this._leader = leader; this._retryTimeMillis = retryTimeMillis; this._lastLeaderContext = new LeaderContext(leaderTerm, leaderCommit); this._inFlightCache = inFlightCache; }
public InFlightLogEntryReader(ReadableRaftLog raftLog, InFlightCache inFlightCache, bool pruneAfterRead) { this._raftLog = raftLog; this._inFlightCache = inFlightCache; this._pruneAfterRead = pruneAfterRead; }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: public ConsensusModule(org.neo4j.causalclustering.identity.MemberId myself, final org.neo4j.graphdb.factory.module.PlatformModule platformModule, org.neo4j.causalclustering.messaging.Outbound<org.neo4j.causalclustering.identity.MemberId,RaftMessages_RaftMessage> outbound, java.io.File clusterStateDirectory, org.neo4j.causalclustering.discovery.CoreTopologyService coreTopologyService) public ConsensusModule(MemberId myself, PlatformModule platformModule, Outbound <MemberId, RaftMessages_RaftMessage> outbound, File clusterStateDirectory, CoreTopologyService coreTopologyService) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.configuration.Config config = platformModule.config; Config config = platformModule.Config; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.logging.internal.LogService logging = platformModule.logging; LogService logging = platformModule.Logging; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.io.fs.FileSystemAbstraction fileSystem = platformModule.fileSystem; FileSystemAbstraction fileSystem = platformModule.FileSystem; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.lifecycle.LifeSupport life = platformModule.life; LifeSupport life = platformModule.Life; LogProvider logProvider = logging.InternalLogProvider; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.causalclustering.core.state.storage.SafeChannelMarshal<org.neo4j.causalclustering.core.replication.ReplicatedContent> marshal = org.neo4j.causalclustering.messaging.marshalling.CoreReplicatedContentMarshal.marshaller(); SafeChannelMarshal <ReplicatedContent> marshal = CoreReplicatedContentMarshal.marshaller(); RaftLog underlyingLog = CreateRaftLog(config, life, fileSystem, clusterStateDirectory, marshal, logProvider, platformModule.JobScheduler); _raftLog = new MonitoredRaftLog(underlyingLog, platformModule.Monitors); StateStorage <TermState> termState; StateStorage <VoteState> voteState; StateStorage <RaftMembershipState> raftMembershipStorage; StateStorage <TermState> durableTermState = life.Add(new DurableStateStorage <TermState>(fileSystem, clusterStateDirectory, RAFT_TERM_NAME, new TermState.Marshal(), config.Get(CausalClusteringSettings.term_state_size), logProvider)); termState = new MonitoredTermStateStorage(durableTermState, platformModule.Monitors); voteState = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, RAFT_VOTE_NAME, new VoteState.Marshal(new MemberId.Marshal()), config.Get(CausalClusteringSettings.vote_state_size), logProvider)); raftMembershipStorage = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, RAFT_MEMBERSHIP_NAME, new RaftMembershipState.Marshal(), config.Get(CausalClusteringSettings.raft_membership_state_size), logProvider)); TimerService timerService = new TimerService(platformModule.JobScheduler, logProvider); _leaderAvailabilityTimers = CreateElectionTiming(config, timerService, logProvider); int?minimumConsensusGroupSize = config.Get(CausalClusteringSettings.minimum_core_cluster_size_at_runtime); MemberIdSetBuilder memberSetBuilder = new MemberIdSetBuilder(); SendToMyself leaderOnlyReplicator = new SendToMyself(myself, outbound); _raftMembershipManager = new RaftMembershipManager(leaderOnlyReplicator, memberSetBuilder, _raftLog, logProvider, minimumConsensusGroupSize.Value, _leaderAvailabilityTimers.ElectionTimeout, systemClock(), config.Get(join_catch_up_timeout).toMillis(), raftMembershipStorage); platformModule.Dependencies.satisfyDependency(_raftMembershipManager); life.Add(_raftMembershipManager); _inFlightCache = InFlightCacheFactory.create(config, platformModule.Monitors); RaftLogShippingManager logShipping = new RaftLogShippingManager(outbound, logProvider, _raftLog, timerService, systemClock(), myself, _raftMembershipManager, _leaderAvailabilityTimers.ElectionTimeout, config.Get(catchup_batch_size), config.Get(log_shipping_max_lag), _inFlightCache); bool supportsPreVoting = config.Get(CausalClusteringSettings.enable_pre_voting); _raftMachine = new RaftMachine(myself, termState, voteState, _raftLog, _leaderAvailabilityTimers, outbound, logProvider, _raftMembershipManager, logShipping, _inFlightCache, config.Get(refuse_to_be_leader), supportsPreVoting, platformModule.Monitors); DurationSinceLastMessageMonitor durationSinceLastMessageMonitor = new DurationSinceLastMessageMonitor(); platformModule.Monitors.addMonitorListener(durationSinceLastMessageMonitor); platformModule.Dependencies.satisfyDependency(durationSinceLastMessageMonitor); string dbName = config.Get(CausalClusteringSettings.database); life.Add(new RaftCoreTopologyConnector(coreTopologyService, _raftMachine, dbName)); life.Add(logShipping); }
public override void ApplyTo(InFlightCache inFlightCache, Log log) { // only the actual log prunes }
public override void ApplyTo(InFlightCache inFlightCache, Log log) { inFlightCache.Put(Index, Entry); }
public override void ApplyTo(InFlightCache inFlightCache, Log log) { log.Debug("Start truncating in-flight-map from index %d. Current map:%n%s", FromIndex, inFlightCache); inFlightCache.Truncate(FromIndex); }