Ejemplo n.º 1
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        public virtual void TestFinalizeErrorReportedToNNStorage()
        {
            FilePath f = new FilePath(TestEditLog.TestDir + "/filejournaltestError");
            // abort after 10th roll
            NNStorage storage = TestEditLog.SetupEdits(Sharpen.Collections.SingletonList <URI>
                                                           (f.ToURI()), 10, new TestEditLog.AbortSpec(10, 0));

            Storage.StorageDirectory sd = storage.DirIterator(NNStorage.NameNodeDirType.Edits
                                                              ).Next();
            FileJournalManager jm         = new FileJournalManager(conf, sd, storage);
            string             sdRootPath = sd.GetRoot().GetAbsolutePath();

            FileUtil.Chmod(sdRootPath, "-w", true);
            try
            {
                jm.FinalizeLogSegment(0, 1);
            }
            finally
            {
                FileUtil.Chmod(sdRootPath, "+w", true);
                NUnit.Framework.Assert.IsTrue(storage.GetRemovedStorageDirs().Contains(sd));
            }
        }