예제 #1
0
 public _RepeatingTestThread_83(HAStressTestHarness _enclosing, int interval, MultithreadedTestUtil.TestContext
                                baseArg1)
     : base(baseArg1)
 {
     this._enclosing = _enclosing;
     this.interval   = interval;
 }
예제 #2
0
 public _RepeatingTestThread_106(HAStressTestHarness _enclosing, int msBetweenFailovers
                                 , MultithreadedTestUtil.TestContext baseArg1)
     : base(baseArg1)
 {
     this._enclosing         = _enclosing;
     this.msBetweenFailovers = msBetweenFailovers;
 }
        public virtual void TestFencingStress()
        {
            HAStressTestHarness harness = new HAStressTestHarness();

            harness.conf.SetInt(DFSConfigKeys.DfsBlockreportIntervalMsecKey, 1000);
            harness.conf.SetInt(DFSConfigKeys.DfsNamenodeHeartbeatRecheckIntervalKey, 1);
            harness.conf.SetInt(DFSConfigKeys.DfsNamenodeReplicationIntervalKey, 1);
            MiniDFSCluster cluster = harness.StartCluster();

            try
            {
                cluster.WaitActive();
                cluster.TransitionToActive(0);
                FileSystem fs = harness.GetFailoverFs();
                MultithreadedTestUtil.TestContext togglers = new MultithreadedTestUtil.TestContext
                                                                 ();
                for (int i = 0; i < NumThreads; i++)
                {
                    Path p = new Path("/test-" + i);
                    DFSTestUtil.CreateFile(fs, p, BlockSize * 10, (short)3, (long)i);
                    togglers.AddThread(new TestDNFencingWithReplication.ReplicationToggler(togglers,
                                                                                           fs, p));
                }
                // Start a separate thread which will make sure that replication
                // happens quickly by triggering deletion reports and replication
                // work calculation frequently.
                harness.AddReplicationTriggerThread(500);
                harness.AddFailoverThread(5000);
                harness.StartThreads();
                togglers.StartThreads();
                togglers.WaitFor(Runtime);
                togglers.Stop();
                harness.StopThreads();
                // CHeck that the files can be read without throwing
                for (int i_1 = 0; i_1 < NumThreads; i_1++)
                {
                    Path p = new Path("/test-" + i_1);
                    DFSTestUtil.ReadFile(fs, p);
                }
            }
            finally
            {
                System.Console.Error.WriteLine("===========================\n\n\n\n");
                harness.Shutdown();
            }
        }
예제 #4
0
        /// <summary>Stress test for pipeline/lease recovery.</summary>
        /// <remarks>
        /// Stress test for pipeline/lease recovery. Starts a number of
        /// threads, each of which creates a file and has another client
        /// break the lease. While these threads run, failover proceeds
        /// back and forth between two namenodes.
        /// </remarks>
        /// <exception cref="System.Exception"/>
        public virtual void TestPipelineRecoveryStress()
        {
            HAStressTestHarness harness = new HAStressTestHarness();

            // Disable permissions so that another user can recover the lease.
            harness.conf.SetBoolean(DFSConfigKeys.DfsPermissionsEnabledKey, false);
            // This test triggers rapid NN failovers.  The client retry policy uses an
            // exponential backoff.  This can quickly lead to long sleep times and even
            // timeout the whole test.  Cap the sleep time at 1s to prevent this.
            harness.conf.SetInt(DFSConfigKeys.DfsClientFailoverSleeptimeMaxKey, 1000);
            MiniDFSCluster cluster = harness.StartCluster();

            try
            {
                cluster.WaitActive();
                cluster.TransitionToActive(0);
                FileSystem                        fs            = harness.GetFailoverFs();
                DistributedFileSystem             fsAsOtherUser = CreateFsAsOtherUser(cluster, harness.conf);
                MultithreadedTestUtil.TestContext testers       = new MultithreadedTestUtil.TestContext
                                                                      ();
                for (int i = 0; i < StressNumThreads; i++)
                {
                    Path p = new Path("/test-" + i);
                    testers.AddThread(new TestPipelinesFailover.PipelineTestThread(testers, fs, fsAsOtherUser
                                                                                   , p));
                }
                // Start a separate thread which will make sure that replication
                // happens quickly by triggering deletion reports and replication
                // work calculation frequently.
                harness.AddReplicationTriggerThread(500);
                harness.AddFailoverThread(5000);
                harness.StartThreads();
                testers.StartThreads();
                testers.WaitFor(StressRuntime);
                testers.Stop();
                harness.StopThreads();
            }
            finally
            {
                System.Console.Error.WriteLine("===========================\n\n\n\n");
                harness.Shutdown();
            }
        }