Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToDownloadToRejoinedInstanceAfterPruning() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToDownloadToRejoinedInstanceAfterPruning()
        {
            // given
            IDictionary <string, string> coreParams = stringMap();

            coreParams[raft_log_rotation_size.name()]          = "1K";
            coreParams[raft_log_pruning_strategy.name()]       = "keep_none";
            coreParams[raft_log_pruning_frequency.name()]      = "100ms";
            coreParams[state_machine_flush_window_size.name()] = "64";
            int numberOfTransactions = 100;

            // start the cluster
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = clusterRule.withSharedCoreParams(coreParams).startCluster();
            Cluster <object> cluster = ClusterRule.withSharedCoreParams(coreParams).startCluster();
            Timeout          timeout = new Timeout(this, Clocks.systemClock(), 120, SECONDS);

            // accumulate some log files
            int firstServerLogFileCount;
            CoreClusterMember firstServer;

            do
            {
                timeout.AssertNotTimedOut();
                firstServer             = DoSomeTransactions(cluster, numberOfTransactions);
                firstServerLogFileCount = GetMostRecentLogIdOn(firstServer);
            } while (firstServerLogFileCount < 5);
            firstServer.Shutdown();

            /* After shutdown we wait until we accumulate enough logs, and so that enough of the old ones
             * have been pruned, so that the rejoined instance won't be able to catch up to without a snapshot. */
            int oldestLogOnSecondServer;
            CoreClusterMember secondServer;

            do
            {
                timeout.AssertNotTimedOut();
                secondServer            = DoSomeTransactions(cluster, numberOfTransactions);
                oldestLogOnSecondServer = GetOldestLogIdOn(secondServer);
            } while (oldestLogOnSecondServer < firstServerLogFileCount + 5);

            // when
            firstServer.Start();

            // then
            dataOnMemberEventuallyLooksLike(firstServer, secondServer);
        }