示例#1
0
 public _Callable_204(StandbyCheckpointer _enclosing, NNStorage.NameNodeFile imageType
                      , long txid)
 {
     this._enclosing = _enclosing;
     this.imageType  = imageType;
     this.txid       = txid;
 }
        public virtual void TestGetOtherNNHttpAddress()
        {
            // Use non-local addresses to avoid host address matching
            Configuration conf = GetHAConf("ns1", "1.2.3.1", "1.2.3.2");

            conf.Set(DFSConfigKeys.DfsNameserviceId, "ns1");
            // This is done by the NN before the StandbyCheckpointer is created
            NameNode.InitializeGenericKeys(conf, "ns1", "nn1");
            // Since we didn't configure the HTTP address, and the default is
            // 0.0.0.0, it should substitute the address from the RPC configuration
            // above.
            StandbyCheckpointer checkpointer = new StandbyCheckpointer(conf, fsn);

            NUnit.Framework.Assert.AreEqual(new Uri("http", "1.2.3.2", DFSConfigKeys.DfsNamenodeHttpPortDefault
                                                    , string.Empty), checkpointer.GetActiveNNAddress());
        }
示例#3
0
        /// <summary>
        /// Test cancellation of ongoing checkpoints when failover happens
        /// mid-checkpoint.
        /// </summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestCheckpointCancellation()
        {
            cluster.TransitionToStandby(0);
            // Create an edit log in the shared edits dir with a lot
            // of mkdirs operations. This is solely so that the image is
            // large enough to take a non-trivial amount of time to load.
            // (only ~15MB)
            URI      sharedUri = cluster.GetSharedEditsDir(0, 1);
            FilePath sharedDir = new FilePath(sharedUri.GetPath(), "current");
            FilePath tmpDir    = new FilePath(MiniDFSCluster.GetBaseDirectory(), "testCheckpointCancellation-tmp"
                                              );
            FSNamesystem fsn = cluster.GetNamesystem(0);

            FSImageTestUtil.CreateAbortedLogWithMkdirs(tmpDir, NumDirsInLog, 3, fsn.GetFSDirectory
                                                           ().GetLastInodeId() + 1);
            string fname = NNStorage.GetInProgressEditsFileName(3);

            new FilePath(tmpDir, fname).RenameTo(new FilePath(sharedDir, fname));
            // Checkpoint as fast as we can, in a tight loop.
            cluster.GetConfiguration(1).SetInt(DFSConfigKeys.DfsNamenodeCheckpointPeriodKey,
                                               0);
            cluster.RestartNameNode(1);
            nn1 = cluster.GetNameNode(1);
            cluster.TransitionToActive(0);
            bool canceledOne = false;

            for (int i = 0; i < 10 && !canceledOne; i++)
            {
                DoEdits(i * 10, i * 10 + 10);
                cluster.TransitionToStandby(0);
                cluster.TransitionToActive(1);
                cluster.TransitionToStandby(1);
                cluster.TransitionToActive(0);
                canceledOne = StandbyCheckpointer.GetCanceledCount() > 0;
            }
            NUnit.Framework.Assert.IsTrue(canceledOne);
        }
示例#4
0
 private CheckpointerThread(StandbyCheckpointer _enclosing)
     : base("Standby State Checkpointer")
 {
     this._enclosing = _enclosing;
 }