Ejemplo n.º 1
0
 public StoreCopyClient(CatchUpClient catchUpClient, Monitors monitors, LogProvider logProvider, TimeoutStrategy backOffStrategy)
 {
     this._catchUpClient = catchUpClient;
     this._monitors      = monitors;
     _log = logProvider.getLog(this.GetType());
     this._backOffStrategy = backOffStrategy;
 }
Ejemplo n.º 2
0
 internal CatchUpChannel(CatchUpClient outerInstance, AdvertisedSocketAddress destination)
 {
     this._outerInstance      = outerInstance;
     this.DestinationConflict = destination;
     Handler   = new TrackingResponseHandler(new CatchUpResponseAdaptor(), outerInstance.clock);
     Bootstrap = (new Bootstrap()).group(outerInstance.eventLoopGroup).channel(typeof(NioSocketChannel)).handler(outerInstance.channelInitializer.apply(Handler));
 }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _logProvider   = new DuplicatingLogProvider(_assertableLogProvider, FormattedLogProvider.withDefaultLogLevel(Level.DEBUG).toOutputStream(System.out));
            _serverHandler = new TestCatchupServerHandler(_logProvider, TestDirectory, _fsa);
            _serverHandler.addFile(_fileA);
            _serverHandler.addFile(_fileB);
            _serverHandler.addIndexFile(_indexFileA);
            WriteContents(_fsa, Relative(_fileA.Filename), _fileA.Content);
            WriteContents(_fsa, Relative(_fileB.Filename), _fileB.Content);
            WriteContents(_fsa, Relative(_indexFileA.Filename), _indexFileA.Content);

            ListenSocketAddress listenAddress = new ListenSocketAddress("localhost", PortAuthority.allocatePort());

            _catchupServer = (new CatchupServerBuilder(_serverHandler)).listenAddress(listenAddress).build();
            _catchupServer.start();

            CatchUpClient catchUpClient = (new CatchupClientBuilder()).build();

            catchUpClient.Start();

            ConstantTimeTimeoutStrategy storeCopyBackoffStrategy = new ConstantTimeTimeoutStrategy(1, TimeUnit.MILLISECONDS);

            Monitors monitors = new Monitors();

            _subject = new StoreCopyClient(catchUpClient, monitors, _logProvider, storeCopyBackoffStrategy);
        }
Ejemplo n.º 4
0
        private BackupDelegator BackupDelegatorFromConfig(PageCache pageCache, Config config)
        {
            CatchUpClient catchUpClient = catchUpClient(config);
            TxPullClient  txPullClient  = new TxPullClient(catchUpClient, Monitors);
            ExponentialBackoffStrategy backOffStrategy = new ExponentialBackoffStrategy(1, config.Get(CausalClusteringSettings.store_copy_backoff_max_wait).toMillis(), TimeUnit.MILLISECONDS);
            StoreCopyClient            storeCopyClient = new StoreCopyClient(catchUpClient, Monitors, LogProvider, backOffStrategy);

            RemoteStore remoteStore = new RemoteStore(LogProvider, FileSystemAbstraction, pageCache, storeCopyClient, txPullClient, TransactionLogCatchUpFactory, config, Monitors);

            return(BackupDelegator(remoteStore, catchUpClient, storeCopyClient));
        }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
0
        private CatchUpClient CreateCatchupClient(NettyPipelineBuilderFactory clientPipelineBuilderFactory)
        {
            SupportedProtocolCreator                 supportedProtocolCreator   = new SupportedProtocolCreator(_config, _logProvider);
            ApplicationSupportedProtocols            supportedCatchupProtocols  = supportedProtocolCreator.CreateSupportedCatchupProtocol();
            ICollection <ModifierSupportedProtocols> supportedModifierProtocols = supportedProtocolCreator.CreateSupportedModifierProtocols();
            Duration handshakeTimeout = _config.get(CausalClusteringSettings.handshake_timeout);

            CatchUpClient catchUpClient = (new CatchupClientBuilder(supportedCatchupProtocols, supportedModifierProtocols, clientPipelineBuilderFactory, handshakeTimeout, _logProvider, _userLogProvider, systemClock())).build();

            _platformModule.life.add(catchUpClient);
            return(catchUpClient);
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void startDb() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void StartDb()
        {
            _temporaryDirectory = TestDirectory.directory("temp");
            _graphDb            = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).setFileSystem(_fsa).newEmbeddedDatabase(TestDirectory.databaseDir());
            CreateLegacyIndex();
            CreatePropertyIndex();
            AddData(_graphDb);

            _catchupServer = new TestCatchupServer(_fsa, _graphDb);
            _catchupServer.start();
            _catchupClient = (new CatchupClientBuilder()).build();
            _catchupClient.start();
            _pageCache = _graphDb.DependencyResolver.resolveDependency(typeof(PageCache));
        }
Ejemplo n.º 8
0
        public CatchupPollingProcess(LogProvider logProvider, LocalDatabase localDatabase, Suspendable enableDisableOnSoreCopy, CatchUpClient catchUpClient, UpstreamDatabaseStrategySelector selectionStrategy, TimerService timerService, long txPullIntervalMillis, BatchingTxApplier applier, Monitors monitors, StoreCopyProcess storeCopyProcess, System.Func <DatabaseHealth> databaseHealthSupplier, TopologyService topologyService)

        {
            this._localDatabase            = localDatabase;
            this._log                      = logProvider.getLog(this.GetType());
            this._enableDisableOnStoreCopy = enableDisableOnSoreCopy;
            this._catchUpClient            = catchUpClient;
            this._selectionStrategy        = selectionStrategy;
            this._timerService             = timerService;
            this._txPullIntervalMillis     = txPullIntervalMillis;
            this._applier                  = applier;
            this._pullRequestMonitor       = monitors.NewMonitor(typeof(PullRequestMonitor));
            this._storeCopyProcess         = storeCopyProcess;
            this._databaseHealthSupplier   = databaseHealthSupplier;
            this._topologyService          = topologyService;
        }
Ejemplo n.º 9
0
 internal ReleaseOnComplete(CatchUpClient outerInstance, CatchUpChannel catchUpChannel)
 {
     this._outerInstance = outerInstance;
     this.CatchUpChannel = catchUpChannel;
 }
Ejemplo n.º 10
0
 public TxPullClient(CatchUpClient catchUpClient, Monitors monitors)
 {
     this._catchUpClient      = catchUpClient;
     this._pullRequestMonitor = monitors.NewMonitor(typeof(PullRequestMonitor));
 }
Ejemplo n.º 11
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 EnterpriseReadReplicaEditionModule(final org.neo4j.graphdb.factory.module.PlatformModule platformModule, final org.neo4j.causalclustering.discovery.DiscoveryServiceFactory discoveryServiceFactory, org.neo4j.causalclustering.identity.MemberId myself)
        public EnterpriseReadReplicaEditionModule(PlatformModule platformModule, DiscoveryServiceFactory discoveryServiceFactory, MemberId myself)
        {
            LogService logging = platformModule.Logging;

            IoLimiterConflict = new ConfigurableIOLimiter(platformModule.Config);
            platformModule.JobScheduler.TopLevelGroupName = "ReadReplica " + myself;

            Dependencies          dependencies = platformModule.Dependencies;
            Config                config       = platformModule.Config;
            FileSystemAbstraction fileSystem   = platformModule.FileSystem;
            PageCache             pageCache    = platformModule.PageCache;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.io.layout.DatabaseLayout databaseLayout = platformModule.storeLayout.databaseLayout(config.get(org.neo4j.graphdb.factory.GraphDatabaseSettings.active_database));
            DatabaseLayout databaseLayout = platformModule.StoreLayout.databaseLayout(config.Get(GraphDatabaseSettings.active_database));

            LifeSupport life = platformModule.Life;

            ThreadToTransactionBridgeConflict = dependencies.SatisfyDependency(new ThreadToStatementContextBridge(GetGlobalAvailabilityGuard(platformModule.Clock, logging, platformModule.Config)));
            this.AccessCapabilityConflict     = new ReadOnly();

            WatcherServiceFactoryConflict = dir => CreateFileSystemWatcherService(fileSystem, dir, logging, platformModule.JobScheduler, config, FileWatcherFileNameFilter());
            dependencies.SatisfyDependencies(WatcherServiceFactoryConflict);

            ReadReplicaLockManager emptyLockManager = new ReadReplicaLockManager();

            LocksSupplierConflict = () => emptyLockManager;
            StatementLocksFactoryProviderConflict = locks => (new StatementLocksFactorySelector(locks, config, logging)).select();

            IdContextFactoryConflict = IdContextFactoryBuilder.of(new EnterpriseIdTypeConfigurationProvider(config), platformModule.JobScheduler).withFileSystem(fileSystem).build();

            TokenHoldersProviderConflict = databaseName => new TokenHolders(new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_PROPERTY_KEY), new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_LABEL), new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_RELATIONSHIP_TYPE));

            File contextDirectory = platformModule.StoreLayout.storeDirectory();

            life.Add(dependencies.SatisfyDependency(new KernelData(fileSystem, pageCache, contextDirectory, config, platformModule.DataSourceManager)));

            HeaderInformationFactoryConflict = TransactionHeaderInformationFactory.DEFAULT;

            SchemaWriteGuardConflict = () =>
            {
            };

            TransactionStartTimeoutConflict = config.Get(GraphDatabaseSettings.transaction_start_timeout).toMillis();

            ConstraintSemanticsConflict = new EnterpriseConstraintSemantics();

            PublishEditionInfo(dependencies.ResolveDependency(typeof(UsageData)), platformModule.DatabaseInfo, config);
            CommitProcessFactoryConflict = ReadOnly();

            ConnectionTrackerConflict = dependencies.SatisfyDependency(CreateConnectionTracker());

            _logProvider = platformModule.Logging.InternalLogProvider;
            LogProvider userLogProvider = platformModule.Logging.UserLogProvider;

            _logProvider.getLog(this.GetType()).info(string.Format("Generated new id: {0}", myself));

            RemoteMembersResolver hostnameResolver = chooseResolver(config, platformModule.Logging);

            ConfigureDiscoveryService(discoveryServiceFactory, dependencies, config, _logProvider);

            _topologyService = discoveryServiceFactory.ReadReplicaTopologyService(config, _logProvider, platformModule.JobScheduler, myself, hostnameResolver, ResolveStrategy(config, _logProvider));

            life.Add(dependencies.SatisfyDependency(_topologyService));

            // We need to satisfy the dependency here to keep users of it, such as BoltKernelExtension, happy.
            dependencies.SatisfyDependency(SslPolicyLoader.create(config, _logProvider));

            DuplexPipelineWrapperFactory pipelineWrapperFactory = pipelineWrapperFactory();
            PipelineWrapper serverPipelineWrapper       = pipelineWrapperFactory.ForServer(config, dependencies, _logProvider, CausalClusteringSettings.ssl_policy);
            PipelineWrapper clientPipelineWrapper       = pipelineWrapperFactory.ForClient(config, dependencies, _logProvider, CausalClusteringSettings.ssl_policy);
            PipelineWrapper backupServerPipelineWrapper = pipelineWrapperFactory.ForServer(config, dependencies, _logProvider, OnlineBackupSettings.ssl_policy);

            NettyPipelineBuilderFactory clientPipelineBuilderFactory       = new NettyPipelineBuilderFactory(clientPipelineWrapper);
            NettyPipelineBuilderFactory serverPipelineBuilderFactory       = new NettyPipelineBuilderFactory(serverPipelineWrapper);
            NettyPipelineBuilderFactory backupServerPipelineBuilderFactory = new NettyPipelineBuilderFactory(backupServerPipelineWrapper);

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

            ApplicationProtocolRepository applicationProtocolRepository = new ApplicationProtocolRepository(Protocol_ApplicationProtocols.values(), supportedCatchupProtocols);
            ModifierProtocolRepository    modifierProtocolRepository    = new ModifierProtocolRepository(Org.Neo4j.causalclustering.protocol.Protocol_ModifierProtocols.values(), supportedModifierProtocols);

            System.Func <CatchUpResponseHandler, ChannelInitializer <SocketChannel> > channelInitializer = handler =>
            {
                ProtocolInstallerRepository <ProtocolInstaller.Orientation.Client> protocolInstallerRepository = new ProtocolInstallerRepository <ProtocolInstaller.Orientation.Client>(singletonList(new CatchupProtocolClientInstaller.Factory(clientPipelineBuilderFactory, _logProvider, handler)), ModifierProtocolInstaller.allClientInstallers);
                Duration handshakeTimeout = config.Get(CausalClusteringSettings.handshake_timeout);
                return(new HandshakeClientInitializer(applicationProtocolRepository, modifierProtocolRepository, protocolInstallerRepository, clientPipelineBuilderFactory, handshakeTimeout, _logProvider, userLogProvider));
            };

            long inactivityTimeoutMs = config.Get(CausalClusteringSettings.catch_up_client_inactivity_timeout).toMillis();

            CatchUpClient catchUpClient = life.Add(new CatchUpClient(_logProvider, Clocks.systemClock(), inactivityTimeoutMs, channelInitializer));

//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));

            StoreFiles storeFiles = new StoreFiles(fileSystem, pageCache);
            LogFiles   logFiles   = BuildLocalDatabaseLogFiles(platformModule, fileSystem, databaseLayout, config);

            LocalDatabase localDatabase = new LocalDatabase(databaseLayout, storeFiles, logFiles, platformModule.DataSourceManager, databaseHealthSupplier, GetGlobalAvailabilityGuard(platformModule.Clock, platformModule.Logging, platformModule.Config), _logProvider);

            System.Func <TransactionCommitProcess> writableCommitProcess = () => new TransactionRepresentationCommitProcess(localDatabase.DataSource().DependencyResolver.resolveDependency(typeof(TransactionAppender)), localDatabase.DataSource().DependencyResolver.resolveDependency(typeof(StorageEngine)));

            LifeSupport txPulling    = new LifeSupport();
            int         maxBatchSize = config.Get(CausalClusteringSettings.read_replica_transaction_applier_batch_size);

            CommandIndexTracker commandIndexTracker = platformModule.Dependencies.satisfyDependency(new CommandIndexTracker());
            BatchingTxApplier   batchingTxApplier   = new BatchingTxApplier(maxBatchSize, () => localDatabase.DataSource().DependencyResolver.resolveDependency(typeof(TransactionIdStore)), writableCommitProcess, platformModule.Monitors, platformModule.Tracers.pageCursorTracerSupplier, platformModule.VersionContextSupplier, commandIndexTracker, _logProvider);

            TimerService timerService = new TimerService(platformModule.JobScheduler, _logProvider);

            ExponentialBackoffStrategy storeCopyBackoffStrategy = new ExponentialBackoffStrategy(1, config.Get(CausalClusteringSettings.store_copy_backoff_max_wait).toMillis(), TimeUnit.MILLISECONDS);

            RemoteStore remoteStore = new RemoteStore(platformModule.Logging.InternalLogProvider, fileSystem, platformModule.PageCache, new StoreCopyClient(catchUpClient, platformModule.Monitors, _logProvider, storeCopyBackoffStrategy), new TxPullClient(catchUpClient, platformModule.Monitors), new TransactionLogCatchUpFactory(), config, platformModule.Monitors);

            CopiedStoreRecovery copiedStoreRecovery = new CopiedStoreRecovery(config, platformModule.KernelExtensionFactories, platformModule.PageCache);

            txPulling.Add(copiedStoreRecovery);

            CompositeSuspendable servicesToStopOnStoreCopy = new CompositeSuspendable();

            StoreCopyProcess storeCopyProcess = new StoreCopyProcess(fileSystem, pageCache, localDatabase, copiedStoreRecovery, remoteStore, _logProvider);

            ConnectToRandomCoreServerStrategy defaultStrategy = new ConnectToRandomCoreServerStrategy();

            defaultStrategy.Inject(_topologyService, config, _logProvider, myself);

            UpstreamDatabaseStrategySelector upstreamDatabaseStrategySelector = CreateUpstreamDatabaseStrategySelector(myself, config, _logProvider, _topologyService, defaultStrategy);

            CatchupPollingProcess catchupProcess = new CatchupPollingProcess(_logProvider, localDatabase, servicesToStopOnStoreCopy, catchUpClient, upstreamDatabaseStrategySelector, timerService, config.Get(CausalClusteringSettings.pull_interval).toMillis(), batchingTxApplier, platformModule.Monitors, storeCopyProcess, databaseHealthSupplier, _topologyService);

            dependencies.SatisfyDependencies(catchupProcess);

            txPulling.Add(batchingTxApplier);
            txPulling.Add(catchupProcess);
            txPulling.Add(new WaitForUpToDateStore(catchupProcess, _logProvider));

            ExponentialBackoffStrategy retryStrategy = new ExponentialBackoffStrategy(1, 30, TimeUnit.SECONDS);

            life.Add(new ReadReplicaStartupProcess(remoteStore, localDatabase, txPulling, upstreamDatabaseStrategySelector, retryStrategy, _logProvider, platformModule.Logging.UserLogProvider, storeCopyProcess, _topologyService));

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

            InstalledProtocolHandler installedProtocolHandler = new InstalledProtocolHandler();               // TODO: hook into a procedure
            Server catchupServer = (new CatchupServerBuilder(catchupServerHandler)).serverHandler(installedProtocolHandler).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, installedProtocolHandler);
            Optional <Server> backupCatchupServer = transactionBackupServiceProvider.ResolveIfBackupEnabled(config);

            servicesToStopOnStoreCopy.Add(catchupServer);
            backupCatchupServer.ifPresent(servicesToStopOnStoreCopy.add);

            life.Add(catchupServer);                 // must start last and stop first, since it handles external requests
            backupCatchupServer.ifPresent(life.add);
        }
Ejemplo n.º 12
0
 private static BackupDelegator BackupDelegator(RemoteStore remoteStore, CatchUpClient catchUpClient, StoreCopyClient storeCopyClient)
 {
     return(new BackupDelegator(remoteStore, catchUpClient, storeCopyClient));
 }
Ejemplo n.º 13
0
        private CoreStateDownloader CreateCoreStateDownloader(Suspendable servicesToSuspendOnStoreCopy, CatchUpClient catchUpClient)
        {
            ExponentialBackoffStrategy storeCopyBackoffStrategy = new ExponentialBackoffStrategy(1, _config.get(CausalClusteringSettings.store_copy_backoff_max_wait).toMillis(), TimeUnit.MILLISECONDS);

            RemoteStore remoteStore = new RemoteStore(_logProvider, _platformModule.fileSystem, _platformModule.pageCache, new StoreCopyClient(catchUpClient, _platformModule.monitors, _logProvider, storeCopyBackoffStrategy), new TxPullClient(catchUpClient, _platformModule.monitors), new TransactionLogCatchUpFactory(), _config, _platformModule.monitors);

            CopiedStoreRecovery copiedStoreRecovery = _platformModule.life.add(new CopiedStoreRecovery(_platformModule.config, _platformModule.kernelExtensionFactories, _platformModule.pageCache));

            StoreCopyProcess storeCopyProcess = new StoreCopyProcess(_platformModule.fileSystem, _platformModule.pageCache, _localDatabase, copiedStoreRecovery, remoteStore, _logProvider);

            CommitStateHelper commitStateHelper = new CommitStateHelper(_platformModule.pageCache, _platformModule.fileSystem, _config);

            return(new CoreStateDownloader(_localDatabase, servicesToSuspendOnStoreCopy, remoteStore, catchUpClient, _logProvider, storeCopyProcess, _coreStateMachinesModule.coreStateMachines, _snapshotService, commitStateHelper));
        }
Ejemplo n.º 14
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);
        }