Beispiel #1
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;
 }
Beispiel #2
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;
 }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void availabilityGuardDroppedOnStart()
        public virtual void AvailabilityGuardDroppedOnStart()
        {
            AvailabilityGuard guard = NewAvailabilityGuard();

            assertTrue(guard.Available);

            LocalDatabase localDatabase = NewLocalDatabase(guard);

            assertFalse(guard.Available);

            localDatabase.Start();
            assertTrue(guard.Available);
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void availabilityGuardRaisedBeforeDataSourceManagerIsStoppedForStoreCopy() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AvailabilityGuardRaisedBeforeDataSourceManagerIsStoppedForStoreCopy()
        {
            AvailabilityGuard guard             = mock(typeof(DatabaseAvailabilityGuard));
            DataSourceManager dataSourceManager = mock(typeof(DataSourceManager));

            LocalDatabase localDatabase = NewLocalDatabase(guard, dataSourceManager);

            localDatabase.StopForStoreCopy();

            InOrder inOrder = inOrder(guard, dataSourceManager);

            // guard should be raised twice - once during construction and once during stop
            inOrder.verify(guard, times(2)).require(any());
            inOrder.verify(dataSourceManager).stop();
        }
Beispiel #5
0
 public PullerFactory(RequestContextFactory requestContextFactory, Master master, LastUpdateTime lastUpdateTime, LogProvider logging, InstanceId serverId, InvalidEpochExceptionHandler invalidEpochHandler, long pullInterval, JobScheduler jobScheduler, DependencyResolver dependencyResolver, AvailabilityGuard availabilityGuard, HighAvailabilityMemberStateMachine memberStateMachine, Monitors monitors, Config config)
 {
     this._requestContextFactory = requestContextFactory;
     this._master              = master;
     this._lastUpdateTime      = lastUpdateTime;
     this._logging             = logging;
     this._serverId            = serverId;
     this._invalidEpochHandler = invalidEpochHandler;
     this._pullInterval        = pullInterval;
     this._jobScheduler        = jobScheduler;
     this._dependencyResolver  = dependencyResolver;
     this._availabilityGuard   = availabilityGuard;
     this._memberStateMachine  = memberStateMachine;
     this._monitors            = monitors;
     this._activeDatabaseName  = config.Get(GraphDatabaseSettings.active_database);
 }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void logOnAvailabilityChange()
        public virtual void LogOnAvailabilityChange()
        {
            // Given
            Log log = mock(typeof(Log));
            AvailabilityGuard databaseAvailabilityGuard = GetDatabaseAvailabilityGuard(_clock, log);

            // When starting out
            verifyZeroInteractions(log);

            // When requirement is added
            databaseAvailabilityGuard.Require(_requirement_1);

            // Then log should have been called
            VerifyLogging(log, atLeastOnce());

            // When requirement fulfilled
            databaseAvailabilityGuard.Fulfill(_requirement_1);

            // Then log should have been called
            VerifyLogging(log, times(4));

            // When requirement is added
            databaseAvailabilityGuard.Require(_requirement_1);
            databaseAvailabilityGuard.Require(_requirement_2);

            // Then log should have been called
            VerifyLogging(log, times(6));

            // When requirement fulfilled
            databaseAvailabilityGuard.Fulfill(_requirement_1);

            // Then log should not have been called
            VerifyLogging(log, times(6));

            // When requirement fulfilled
            databaseAvailabilityGuard.Fulfill(_requirement_2);

            // Then log should have been called
            VerifyLogging(log, times(8));
        }
Beispiel #7
0
        public ReplicationModule(RaftMachine raftMachine, MemberId myself, PlatformModule platformModule, Config config, Outbound <MemberId, Org.Neo4j.causalclustering.core.consensus.RaftMessages_RaftMessage> outbound, File clusterStateDirectory, FileSystemAbstraction fileSystem, LogProvider logProvider, AvailabilityGuard globalAvailabilityGuard, LocalDatabase localDatabase)
        {
            LifeSupport life = platformModule.Life;

            DurableStateStorage <GlobalSessionTrackerState> sessionTrackerStorage;

            sessionTrackerStorage = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, SESSION_TRACKER_NAME, new GlobalSessionTrackerState.Marshal(new MemberId.Marshal()), config.Get(CausalClusteringSettings.global_session_tracker_state_size), logProvider));

            _sessionTracker = new SessionTracker(sessionTrackerStorage);

            GlobalSession    myGlobalSession = new GlobalSession(System.Guid.randomUUID(), myself);
            LocalSessionPool sessionPool     = new LocalSessionPool(myGlobalSession);

            _progressTracker = new ProgressTrackerImpl(myGlobalSession);

            Duration initialBackoff    = config.Get(CausalClusteringSettings.replication_retry_timeout_base);
            Duration upperBoundBackoff = config.Get(CausalClusteringSettings.replication_retry_timeout_limit);

            TimeoutStrategy progressRetryStrategy     = new ExponentialBackoffStrategy(initialBackoff, upperBoundBackoff);
            long            availabilityTimeoutMillis = config.Get(CausalClusteringSettings.replication_retry_timeout_base).toMillis();

            _replicator = new RaftReplicator(raftMachine, myself, outbound, sessionPool, _progressTracker, progressRetryStrategy, availabilityTimeoutMillis, globalAvailabilityGuard, logProvider, localDatabase, platformModule.Monitors);
        }
Beispiel #8
0
 private static LocalDatabase NewLocalDatabase(AvailabilityGuard databaseAvailabilityGuard, DataSourceManager dataSourceManager)
 {
     return(new LocalDatabase(mock(typeof(DatabaseLayout)), mock(typeof(StoreFiles)), mock(typeof(LogFiles)), dataSourceManager, () => mock(typeof(DatabaseHealth)), databaseAvailabilityGuard, NullLogProvider.Instance));
 }
Beispiel #9
0
 private static LocalDatabase NewLocalDatabase(AvailabilityGuard databaseAvailabilityGuard)
 {
     return(NewLocalDatabase(databaseAvailabilityGuard, mock(typeof(DataSourceManager))));
 }