예제 #1
0
 public CoreStateDownloader(LocalDatabase localDatabase, Suspendable suspendOnStoreCopy, RemoteStore remoteStore, CatchUpClient catchUpClient, LogProvider logProvider, StoreCopyProcess storeCopyProcess, CoreStateMachines coreStateMachines, CoreSnapshotService snapshotService, CommitStateHelper commitStateHelper)
 {
     this._localDatabase      = localDatabase;
     this._suspendOnStoreCopy = suspendOnStoreCopy;
     this._remoteStore        = remoteStore;
     this._catchUpClient      = catchUpClient;
     this._log = logProvider.getLog(this.GetType());
     this._storeCopyProcess  = storeCopyProcess;
     this._coreStateMachines = coreStateMachines;
     this._snapshotService   = snapshotService;
     this._commitStateHelper = commitStateHelper;
 }
예제 #2
0
 public CoreSnapshotRequestHandler(CatchupServerProtocol protocol, CoreSnapshotService snapshotService)
 {
     this._protocol        = protocol;
     this._snapshotService = snapshotService;
 }
예제 #3
0
//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 CoreServerModule(org.neo4j.causalclustering.core.IdentityModule identityModule, final org.neo4j.graphdb.factory.module.PlatformModule platformModule, org.neo4j.causalclustering.core.consensus.ConsensusModule consensusModule, org.neo4j.causalclustering.core.state.machines.CoreStateMachinesModule coreStateMachinesModule, org.neo4j.causalclustering.core.state.ClusteringModule clusteringModule, org.neo4j.causalclustering.ReplicationModule replicationModule, org.neo4j.causalclustering.catchup.storecopy.LocalDatabase localDatabase, System.Func<org.neo4j.kernel.internal.DatabaseHealth> dbHealthSupplier, java.io.File clusterStateDirectory, org.neo4j.causalclustering.protocol.NettyPipelineBuilderFactory clientPipelineBuilderFactory, org.neo4j.causalclustering.protocol.NettyPipelineBuilderFactory serverPipelineBuilderFactory, org.neo4j.causalclustering.protocol.NettyPipelineBuilderFactory backupServerPipelineBuilderFactory, org.neo4j.causalclustering.net.InstalledProtocolHandler installedProtocolsHandler)
        public CoreServerModule(IdentityModule identityModule, PlatformModule platformModule, ConsensusModule consensusModule, CoreStateMachinesModule coreStateMachinesModule, ClusteringModule clusteringModule, ReplicationModule replicationModule, LocalDatabase localDatabase, System.Func <DatabaseHealth> dbHealthSupplier, File clusterStateDirectory, NettyPipelineBuilderFactory clientPipelineBuilderFactory, NettyPipelineBuilderFactory serverPipelineBuilderFactory, NettyPipelineBuilderFactory backupServerPipelineBuilderFactory, InstalledProtocolHandler installedProtocolsHandler)
        {
            this._identityModule          = identityModule;
            this._coreStateMachinesModule = coreStateMachinesModule;
            this._consensusModule         = consensusModule;
            this._clusteringModule        = clusteringModule;
            this._localDatabase           = localDatabase;
            this._dbHealthSupplier        = dbHealthSupplier;
            this._platformModule          = platformModule;

            this._config       = platformModule.Config;
            this._jobScheduler = platformModule.JobScheduler;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.util.Dependencies dependencies = platformModule.dependencies;
            Dependencies dependencies = platformModule.Dependencies;
//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;

            this._logProvider     = logging.InternalLogProvider;
            this._userLogProvider = logging.UserLogProvider;

            CompositeSuspendable servicesToStopOnStoreCopy = new CompositeSuspendable();

            StateStorage <long> lastFlushedStorage = platformModule.Life.add(new DurableStateStorage <long>(platformModule.FileSystem, clusterStateDirectory, LAST_FLUSHED_NAME, new LongIndexMarshal(), platformModule.Config.get(CausalClusteringSettings.last_flushed_state_size), _logProvider));

            consensusModule.RaftMembershipManager().RecoverFromIndexSupplier = lastFlushedStorage.getInitialState;

            CoreState coreState = new CoreState(coreStateMachinesModule.CoreStateMachines, replicationModule.SessionTracker, lastFlushedStorage);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final System.Func<org.neo4j.kernel.internal.DatabaseHealth> databaseHealthSupplier = () -> platformModule.dataSourceManager.getDataSource().getDependencyResolver().resolveDependency(org.neo4j.kernel.internal.DatabaseHealth.class);
            System.Func <DatabaseHealth> databaseHealthSupplier = () => platformModule.DataSourceManager.DataSource.DependencyResolver.resolveDependency(typeof(DatabaseHealth));
            _commandApplicationProcess = new CommandApplicationProcess(consensusModule.RaftLog(), platformModule.Config.get(CausalClusteringSettings.state_machine_apply_max_batch_size), platformModule.Config.get(CausalClusteringSettings.state_machine_flush_window_size), databaseHealthSupplier, _logProvider, replicationModule.ProgressTracker, replicationModule.SessionTracker, coreState, consensusModule.InFlightCache(), platformModule.Monitors);

            platformModule.Dependencies.satisfyDependency(_commandApplicationProcess);                 // lastApplied() for CC-robustness

            this._snapshotService = new CoreSnapshotService(_commandApplicationProcess, coreState, consensusModule.RaftLog(), consensusModule.RaftMachine());

            CatchUpClient       catchUpClient = CreateCatchupClient(clientPipelineBuilderFactory);
            CoreStateDownloader downloader    = CreateCoreStateDownloader(servicesToStopOnStoreCopy, catchUpClient);

            this._downloadService = new CoreStateDownloaderService(platformModule.JobScheduler, downloader, _commandApplicationProcess, _logProvider, (new ExponentialBackoffStrategy(1, 30, SECONDS)).newTimeout(), databaseHealthSupplier, platformModule.Monitors);

            this.MembershipWaiterLifecycle = CreateMembershipWaiterLifecycle();

            SupportedProtocolCreator                 supportedProtocolCreator   = new SupportedProtocolCreator(_config, _logProvider);
            ApplicationSupportedProtocols            supportedCatchupProtocols  = supportedProtocolCreator.CreateSupportedCatchupProtocol();
            ICollection <ModifierSupportedProtocols> supportedModifierProtocols = supportedProtocolCreator.CreateSupportedModifierProtocols();

            CheckPointerService  checkPointerService  = new CheckPointerService(() => localDatabase.DataSource().DependencyResolver.resolveDependency(typeof(CheckPointer)), _jobScheduler, Group.CHECKPOINT);
            CatchupServerHandler catchupServerHandler = new RegularCatchupServerHandler(platformModule.Monitors, _logProvider, localDatabase.storeId, localDatabase.dataSource, localDatabase.isAvailable, fileSystem, _snapshotService, checkPointerService);

            _catchupServer = (new CatchupServerBuilder(catchupServerHandler)).serverHandler(installedProtocolsHandler).catchupProtocols(supportedCatchupProtocols).modifierProtocols(supportedModifierProtocols).pipelineBuilder(serverPipelineBuilderFactory).userLogProvider(_userLogProvider).debugLogProvider(_logProvider).listenAddress(_config.get(transaction_listen_address)).serverName("catchup-server").build();

            TransactionBackupServiceProvider transactionBackupServiceProvider = new TransactionBackupServiceProvider(_logProvider, _userLogProvider, supportedCatchupProtocols, supportedModifierProtocols, backupServerPipelineBuilderFactory, catchupServerHandler, installedProtocolsHandler);

            _backupServer = transactionBackupServiceProvider.ResolveIfBackupEnabled(_config);

            RaftLogPruner raftLogPruner = new RaftLogPruner(consensusModule.RaftMachine(), _commandApplicationProcess, platformModule.Clock);

            dependencies.SatisfyDependency(raftLogPruner);

            life.Add(new PruningScheduler(raftLogPruner, _jobScheduler, _config.get(CausalClusteringSettings.raft_log_pruning_frequency).toMillis(), _logProvider));

            servicesToStopOnStoreCopy.Add(this._catchupServer);
            _backupServer.ifPresent(servicesToStopOnStoreCopy.add);
        }