示例#1
0
 /// <param name="delayInMillis"> number of milliseconds between each attempt at getting the desired result </param>
 /// <param name="retries"> the number of attempts to perform before giving up </param> </param>
 /// <param name="logProvider"> {<seealso cref= LogProvider} </seealso>
 public MultiRetryStrategy(long delayInMillis, long retries, LogProvider logProvider, System.Action <long> sleeper)
 {
     this._delayInMillis = delayInMillis;
     this._retries       = retries;
     this._logProvider   = logProvider;
     this._sleeper       = sleeper;
 }
示例#2
0
        /// <param name="sslPolicy"> </param>
        /// <param name="logProvider">
        /// @return </param>
        private static SSLConfig CommonSslConfig(SslPolicy sslPolicy, LogProvider logProvider)
        {
            SSLConfig sslConfig = new SSLConfig();

            if (sslPolicy == null)
            {
                return(sslConfig);
            }
            else
            {
                sslConfig.setFactoryImplementation(new SecureHazelcastContextFactory(sslPolicy, logProvider)).setEnabled(true);
                switch (sslPolicy.ClientAuth)
                {
                case REQUIRE:
                    sslConfig.setProperty("javax.net.ssl.mutualAuthentication", "REQUIRED");
                    break;

                case OPTIONAL:
                    sslConfig.setProperty("javax.net.ssl.mutualAuthentication", "OPTIONAL");
                    goto case NONE;

                case NONE:
                    break;

                default:
                    throw new System.ArgumentException("Not supported: " + sslPolicy.ClientAuth);
                }

                return(sslConfig);
            }
        }
示例#3
0
        protected internal static void ConfigureHazelcast(Config config, LogProvider logProvider)
        {
            GroupProperty.WAIT_SECONDS_BEFORE_JOIN.SystemProperty = "1";
            GroupProperty.PHONE_HOME_ENABLED.SystemProperty       = "false";
            GroupProperty.SOCKET_BIND_ANY.SystemProperty          = "false";
            GroupProperty.SHUTDOWNHOOK_ENABLED.SystemProperty     = "false";

            string licenseKey = config.Get(CausalClusteringSettings.hazelcast_license_key);

            if (!string.ReferenceEquals(licenseKey, null))
            {
                GroupProperty.ENTERPRISE_LICENSE_KEY.SystemProperty = licenseKey;
            }

            // Make hazelcast quiet
            if (config.Get(CausalClusteringSettings.disable_middleware_logging))
            {
                // This is clunky, but the documented programmatic way doesn't seem to work
                GroupProperty.LOGGING_TYPE.SystemProperty = "none";
            }
            else
            {
                HazelcastLogging.Enable(logProvider, new HazelcastLogLevel(config));
            }
        }
示例#4
0
        private static ChildInitializer ChildInitializer(FileSystemAbstraction fileSystem, GraphDatabaseAPI graphDb)
        {
            ApplicationSupportedProtocols catchupProtocols  = new ApplicationSupportedProtocols(CATCHUP, emptyList());
            ModifierSupportedProtocols    modifierProtocols = new ModifierSupportedProtocols(COMPRESSION, emptyList());

            ApplicationProtocolRepository catchupRepository  = new ApplicationProtocolRepository(Protocol_ApplicationProtocols.values(), catchupProtocols);
            ModifierProtocolRepository    modifierRepository = new ModifierProtocolRepository(Protocol_ModifierProtocols.values(), singletonList(modifierProtocols));

            System.Func <CheckPointer>       checkPointer = () => graphDb.DependencyResolver.resolveDependency(typeof(CheckPointer));
            System.Func <bool>               availability = () => graphDb.DependencyResolver.resolveDependency(typeof(DatabaseAvailabilityGuard)).Available;
            System.Func <NeoStoreDataSource> dataSource   = () => graphDb.DependencyResolver.resolveDependency(typeof(NeoStoreDataSource));
            LogProvider logProvider = NullLogProvider.Instance;

            Org.Neo4j.Storageengine.Api.StoreId kernelStoreId = dataSource().StoreId;
            StoreId storeId = new StoreId(kernelStoreId.CreationTime, kernelStoreId.RandomId, kernelStoreId.UpgradeTime, kernelStoreId.UpgradeId);

            CheckPointerService         checkPointerService  = new CheckPointerService(checkPointer, createInitialisedScheduler(), Group.CHECKPOINT);
            RegularCatchupServerHandler catchupServerHandler = new RegularCatchupServerHandler(new Monitors(), logProvider, () => storeId, dataSource, availability, fileSystem, null, checkPointerService);

            NettyPipelineBuilderFactory pipelineBuilder = new NettyPipelineBuilderFactory(VoidPipelineWrapperFactory.VOID_WRAPPER);

            CatchupProtocolServerInstaller.Factory catchupProtocolServerInstaller = new CatchupProtocolServerInstaller.Factory(pipelineBuilder, logProvider, catchupServerHandler);

            ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server> protocolInstallerRepository = new ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server>(singletonList(catchupProtocolServerInstaller), Org.Neo4j.causalclustering.protocol.ModifierProtocolInstaller_Fields.AllServerInstallers);

            return(new HandshakeServerInitializer(catchupRepository, modifierRepository, protocolInstallerRepository, pipelineBuilder, logProvider));
        }
示例#5
0
 public UpdatePullerScheduler(JobScheduler scheduler, LogProvider logProvider, UpdatePuller updatePullingThread, long pullIntervalMillis)
 {
     this._scheduler          = scheduler;
     this._log                = logProvider.getLog(this.GetType());
     this._updatePuller       = updatePullingThread;
     this._pullIntervalMillis = pullIntervalMillis;
 }
示例#6
0
        public ClusteringModule(DiscoveryServiceFactory discoveryServiceFactory, MemberId myself, PlatformModule platformModule, File clusterStateDirectory, DatabaseLayout databaseLayout)
        {
            LifeSupport           life                  = platformModule.Life;
            Config                config                = platformModule.Config;
            LogProvider           logProvider           = platformModule.Logging.InternalLogProvider;
            LogProvider           userLogProvider       = platformModule.Logging.UserLogProvider;
            Dependencies          dependencies          = platformModule.Dependencies;
            Monitors              monitors              = platformModule.Monitors;
            FileSystemAbstraction fileSystem            = platformModule.FileSystem;
            RemoteMembersResolver remoteMembersResolver = chooseResolver(config, platformModule.Logging);

            _topologyService = discoveryServiceFactory.CoreTopologyService(config, myself, platformModule.JobScheduler, logProvider, userLogProvider, remoteMembersResolver, ResolveStrategy(config, logProvider), monitors);

            life.Add(_topologyService);

            dependencies.SatisfyDependency(_topologyService);                 // for tests

            CoreBootstrapper coreBootstrapper = new CoreBootstrapper(databaseLayout, platformModule.PageCache, fileSystem, config, logProvider, platformModule.Monitors);

            SimpleStorage <ClusterId> clusterIdStorage = new SimpleFileStorage <ClusterId>(fileSystem, clusterStateDirectory, CLUSTER_ID_NAME, new ClusterId.Marshal(), logProvider);

            SimpleStorage <DatabaseName> dbNameStorage = new SimpleFileStorage <DatabaseName>(fileSystem, clusterStateDirectory, DB_NAME, new DatabaseName.Marshal(), logProvider);

            string dbName           = config.Get(CausalClusteringSettings.database);
            int    minimumCoreHosts = config.Get(CausalClusteringSettings.minimum_core_cluster_size_at_formation);

            Duration clusterBindingTimeout = config.Get(CausalClusteringSettings.cluster_binding_timeout);

            _clusterBinder = new ClusterBinder(clusterIdStorage, dbNameStorage, _topologyService, Clocks.systemClock(), () => sleep(100), clusterBindingTimeout, coreBootstrapper, dbName, minimumCoreHosts, platformModule.Monitors);
        }
示例#7
0
        private SegmentedRaftLog CreateRaftLog(long rotateAtSize)
        {
            LogProvider            logProvider     = Instance;
            CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory(raft_log_pruning_strategy.DefaultValue, logProvider)).newInstance();

            return(new SegmentedRaftLog(_fileSystemRule.get(), _testDirectory.directory(), rotateAtSize, new DummyRaftableContentSerializer(), logProvider, 0, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy));
        }
示例#8
0
 public DefaultSlaveFactory(LogProvider logProvider, Monitors monitors, int chunkSize, System.Func <LogEntryReader <ReadableClosablePositionAwareChannel> > logEntryReader)
 {
     this._logProvider = logProvider;
     this._monitors    = monitors;
     this._chunkSize   = chunkSize;
     this._entryReader = logEntryReader;
 }
示例#9
0
 public AuthorizationModule(WebServer webServer, System.Func <AuthManager> authManager, LogProvider logProvider, Config config, Pattern[] uriWhitelist)
 {
     this._webServer           = webServer;
     this._config              = config;
     this._authManagerSupplier = authManager;
     this._logProvider         = logProvider;
     this._uriWhitelist        = uriWhitelist;
 }
示例#10
0
 public TransactionFacade(TransitionalPeriodTransactionMessContainer kernel, QueryExecutionEngine engine, GraphDatabaseQueryService queryService, TransactionRegistry registry, LogProvider logProvider)
 {
     this._kernel       = kernel;
     this._engine       = engine;
     this._queryService = queryService;
     this._registry     = registry;
     this._logProvider  = logProvider;
 }
示例#11
0
        private static TopologyServiceRetryStrategy ResolveStrategy(Config config, LogProvider logProvider)
        {
            long refreshPeriodMillis = config.Get(CausalClusteringSettings.cluster_topology_refresh).toMillis();
            int  pollingFrequencyWithinRefreshWindow = 2;
            int  numberOfRetries = pollingFrequencyWithinRefreshWindow + 1;              // we want to have more retries at the given frequency than there is time in a refresh period

            return(new TopologyServiceMultiRetryStrategy(refreshPeriodMillis / pollingFrequencyWithinRefreshWindow, numberOfRetries, logProvider));
        }
示例#12
0
 public SlaveLockManager(Locks localLocks, RequestContextFactory requestContextFactory, Master master, AvailabilityGuard availabilityGuard, LogProvider logProvider, Config config)
 {
     this._requestContextFactory = requestContextFactory;
     this._availabilityGuard     = availabilityGuard;
     this._local       = localLocks;
     this._master      = master;
     this._logProvider = logProvider;
 }
示例#13
0
        private StoreFactory StoreFactory(Config config, params OpenOption[] openOptions)
        {
            LogProvider    logProvider    = NullLogProvider.Instance;
            DatabaseLayout databaseLayout = _testDirectory.databaseLayout();
            RecordFormats  recordFormats  = selectForStoreOrConfig(config, databaseLayout, _fsRule, _pageCache, logProvider);

            return(new StoreFactory(databaseLayout, config, _idGeneratorFactory, _pageCache, _fsRule.get(), recordFormats, logProvider, EmptyVersionContextSupplier.EMPTY, openOptions));
        }
示例#14
0
 internal IndexProxyCreator(IndexSamplingConfig samplingConfig, IndexStoreView storeView, IndexProviderMap providerMap, TokenNameLookup tokenNameLookup, LogProvider logProvider)
 {
     this._samplingConfig  = samplingConfig;
     this._storeView       = storeView;
     this._providerMap     = providerMap;
     this._tokenNameLookup = tokenNameLookup;
     this._logProvider     = logProvider;
 }
示例#15
0
 public LockManagerSwitcher(DelegateInvocationHandler <Locks> @delegate, DelegateInvocationHandler <Master> master, RequestContextFactory requestContextFactory, AvailabilityGuard availabilityGuard, Factory <Locks> locksFactory, LogProvider logProvider, Config config) : base(@delegate)
 {
     this._master = master;
     this._requestContextFactory = requestContextFactory;
     this._availabilityGuard     = availabilityGuard;
     this._locksFactory          = locksFactory;
     this._logProvider           = logProvider;
     this._config = config;
 }
示例#16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _fs       = mock(typeof(FileSystemAbstraction));
            _logFiles = mock(typeof(LogFiles));
            doAnswer(inv => new File((inv.Arguments[0]).ToString())).when(_logFiles).getLogFileForVersion(anyLong());
            _logProvider = NullLogProvider.Instance;
            _clock       = mock(typeof(Clock));
            _factory     = mock(typeof(LogPruneStrategyFactory));
        }
示例#17
0
        internal static void Enable(LogProvider logProvider, Level minLevel)
        {
            HazelcastLogging._logProvider = logProvider;
            HazelcastLogging._minLevel    = minLevel;

            // hazelcast only allows configuring logging through system properties
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            System.setProperty(HZ_LOGGING_CLASS_PROPERTY, typeof(HazelcastLogging).FullName);
        }
示例#18
0
        public override SegmentedRaftLog CreateRaftLog(FileSystemAbstraction fsa, File dir)
        {
            long                   rotateAtSize    = ByteUnit.mebiBytes(8);
            LogProvider            logProvider     = Instance;
            int                    readerPoolSize  = 8;
            CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory(raft_log_pruning_strategy.DefaultValue, logProvider)).newInstance();

            return(new SegmentedRaftLog(fsa, dir, rotateAtSize, new DummyRaftableContentSerializer(), logProvider, readerPoolSize, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy));
        }
示例#19
0
 /// <summary>
 /// Dependencies that can be resolved immediately after launching the backup tool
 /// </summary>
 /// <param name="outsideWorld"> filesystem and output streams that the tool interacts with </param>
 /// <param name="logProvider"> made available to subsequent dependency resolution classes </param>
 /// <param name="monitors"> will become shared across all resolved dependencies </param>
 internal BackupModule(OutsideWorld outsideWorld, LogProvider logProvider, Monitors monitors)
 {
     this._outsideWorld = outsideWorld;
     this._logProvider  = logProvider;
     this._monitors     = monitors;
     this._clock        = Clock.systemDefaultZone();
     this._transactionLogCatchUpFactory = new TransactionLogCatchUpFactory();
     this._fileSystemAbstraction        = outsideWorld.FileSystem();
     this._jobScheduler = createInitialisedScheduler();
 }
示例#20
0
 public SocketTransport(string connector, ListenSocketAddress address, SslContext sslCtx, bool encryptionRequired, LogProvider logging, TransportThrottleGroup throttleGroup, BoltProtocolFactory boltProtocolFactory, NetworkConnectionTracker connectionTracker)
 {
     this._connector           = connector;
     this._address             = address;
     this._sslCtx              = sslCtx;
     this._encryptionRequired  = encryptionRequired;
     this._logging             = logging;
     this._throttleGroup       = throttleGroup;
     this._boltProtocolFactory = boltProtocolFactory;
     this._connectionTracker   = connectionTracker;
 }
示例#21
0
 public RegularCatchupServerHandler(Monitors monitors, LogProvider logProvider, System.Func <StoreId> storeIdSupplier, System.Func <NeoStoreDataSource> dataSourceSupplier, System.Func <bool> dataSourceAvailabilitySupplier, FileSystemAbstraction fs, CoreSnapshotService snapshotService, CheckPointerService checkPointerService)
 {
     this._monitors                       = monitors;
     this._logProvider                    = logProvider;
     this._storeIdSupplier                = storeIdSupplier;
     this._dataSourceSupplier             = dataSourceSupplier;
     this._dataSourceAvailabilitySupplier = dataSourceAvailabilitySupplier;
     this._fs = fs;
     this._snapshotService     = snapshotService;
     this._checkPointerService = checkPointerService;
 }
示例#22
0
        private SegmentedRaftLog CreateRaftLog(long rotateAtSize)
        {
            File directory = new File(RAFT_LOG_DIRECTORY_NAME);

            _logDirectory = Dir.directory(directory.Name);

            LogProvider            logProvider     = Instance;
            CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory("100 entries", logProvider)).NewInstance();

            return(new SegmentedRaftLog(FsRule.get(), _logDirectory, rotateAtSize, CoreReplicatedContentMarshal.marshaller(), logProvider, 8, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy));
        }
示例#23
0
        /// <summary>
        /// Creates an execution engine around the give graph database </summary>
        /// <param name="queryService"> The database to wrap </param>
        /// <param name="logProvider"> A <seealso cref="LogProvider"/> for cypher-statements </param>
        public ExecutionEngine(GraphDatabaseQueryService queryService, LogProvider logProvider, CompilerFactory compilerFactory)
        {
            DependencyResolver  resolver            = queryService.DependencyResolver;
            Monitors            monitors            = resolver.ResolveDependency(typeof(Monitors));
            CacheTracer         cacheTracer         = new MonitoringCacheTracer(monitors.NewMonitor(typeof(StringCacheMonitor)));
            Config              config              = resolver.ResolveDependency(typeof(Config));
            CypherConfiguration cypherConfiguration = CypherConfiguration.fromConfig(config);
            CompilationTracer   tracer              = new TimingCompilationTracer(monitors.NewMonitor(typeof(TimingCompilationTracer.EventListener)));

            _inner = new [email protected](queryService, monitors, tracer, cacheTracer, cypherConfiguration, compilerFactory, logProvider, Clock.systemUTC());
        }
示例#24
0
        private GraphDatabaseService PrepareDb(Label label, string propertyName, LogProvider logProvider)
        {
            GraphDatabaseService db = GetDatabase(logProvider);

            using (Transaction transaction = Db.beginTx())
            {
                Db.schema().constraintFor(label).assertPropertyIsUnique(propertyName).create();
                transaction.Success();
            }
            WaitIndexes(db);
            return(db);
        }
示例#25
0
        public override RaftLog CreateRaftLog()
        {
            File directory = new File(RAFT_LOG_DIRECTORY_NAME);
            FileSystemAbstraction fileSystem = _fsRule.get();

            fileSystem.Mkdir(directory);

            LogProvider            logProvider     = Instance;
            CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory("1 entries", logProvider)).NewInstance();

            return(_life.add(new SegmentedRaftLog(fileSystem, directory, 1024, new DummyRaftableContentSerializer(), logProvider, 8, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy)));
        }
示例#26
0
 public NetworkedServerFactory(LifeSupport life, ProtocolServerFactory protocolServerFactory, TimeoutStrategy timeoutStrategy, LogProvider logProvider, ObjectInputStreamFactory objectInputStreamFactory, ObjectOutputStreamFactory objectOutputStreamFactory, NetworkReceiver.Monitor networkReceiverMonitor, NetworkSender.Monitor networkSenderMonitor, NamedThreadFactory.Monitor namedThreadFactoryMonitor)
 {
     this._life = life;
     this._protocolServerFactory     = protocolServerFactory;
     this._timeoutStrategy           = timeoutStrategy;
     this._networkReceiverMonitor    = networkReceiverMonitor;
     this._networkSenderMonitor      = networkSenderMonitor;
     this._logProvider               = logProvider;
     this._objectInputStreamFactory  = objectInputStreamFactory;
     this._objectOutputStreamFactory = objectOutputStreamFactory;
     this._namedThreadFactoryMonitor = namedThreadFactoryMonitor;
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            Config          = Config.defaults();
            Clock           = Clocks.fakeClock();
            LogPruning      = LogPruning.NO_PRUNING;
            LogProvider     = NullLogProvider.Instance;
            IntervalTx      = Config.get(GraphDatabaseSettings.check_point_interval_tx);
            IntervalTime    = Config.get(GraphDatabaseSettings.check_point_interval_time);
            TriggerConsumer = new LinkedBlockingQueue <string>();
            Triggered       = TriggerConsumer.offer;
            NotTriggered    = s => fail("Should not have triggered: " + s);
        }
示例#28
0
        private ClusterConfiguration ClusterConfiguration(params URI[] uris)
        {
            LogProvider          logProvider = FormattedLogProvider.toOutputStream(System.out);
            ClusterConfiguration toReturn    = new ClusterConfiguration("neo4j.ha", logProvider, asList(uris));

            toReturn.Joined(_clusterId1, _clusterUri1);
            toReturn.Joined(_clusterId2, _clusterUri2);
            if (uris.Length == 3)
            {
                toReturn.Joined(_clusterId3, _clusterUri3);
            }
            return(toReturn);
        }
示例#29
0
        public StoreFactory(DatabaseLayout databaseLayout, Config config, IdGeneratorFactory idGeneratorFactory, PageCache pageCache, FileSystemAbstraction fileSystemAbstraction, RecordFormats recordFormats, LogProvider logProvider, VersionContextSupplier versionContextSupplier, params OpenOption[] openOptions)
        {
            this._databaseLayout         = databaseLayout;
            this._config                 = config;
            this._idGeneratorFactory     = idGeneratorFactory;
            this._fileSystemAbstraction  = fileSystemAbstraction;
            this._versionContextSupplier = versionContextSupplier;
            this._recordFormats          = recordFormats;
            this._openOptions            = openOptions;
            (new RecordFormatPropertyConfigurator(recordFormats, config)).configure();

            this._logProvider = logProvider;
            this._pageCache   = pageCache;
        }
示例#30
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.causalclustering.core.consensus.log.RaftLog createRaftLog() throws Exception
        private RaftLog CreateRaftLog()
        {
            File directory = new File(RAFT_LOG_DIRECTORY_NAME);
            FileSystemAbstraction fileSystem = new EphemeralFileSystemAbstraction();

            fileSystem.Mkdir(directory);

            LogProvider            logProvider     = Instance;
            CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory("1 entries", logProvider)).NewInstance();
            SegmentedRaftLog       newRaftLog      = new SegmentedRaftLog(fileSystem, directory, 1, new DummyRaftableContentSerializer(), logProvider, 8, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy);

            newRaftLog.Start();
            return(newRaftLog);
        }