Exemplo n.º 1
0
 /// <summary>For namenode, Verify that the current and previous directories exist.</summary>
 /// <remarks>
 /// For namenode, Verify that the current and previous directories exist.
 /// Verify that previous hasn't been modified by comparing the checksum of all
 /// its files with their original checksum. It is assumed that the
 /// server has recovered and upgraded.
 /// </remarks>
 /// <exception cref="System.IO.IOException"/>
 internal virtual void CheckNameNode(string[] baseDirs, long imageTxId)
 {
     foreach (string baseDir in baseDirs)
     {
         Log.Info("Checking namenode directory " + baseDir);
         Log.Info("==== Contents ====:\n  " + Joiner.On("  \n").Join(new FilePath(baseDir,
                                                                                  "current").List()));
         Log.Info("==================");
         GenericTestUtils.AssertExists(new FilePath(baseDir, "current"));
         GenericTestUtils.AssertExists(new FilePath(baseDir, "current/VERSION"));
         GenericTestUtils.AssertExists(new FilePath(baseDir, "current/" + NNStorage.GetInProgressEditsFileName
                                                        (imageTxId + 1)));
         GenericTestUtils.AssertExists(new FilePath(baseDir, "current/" + NNStorage.GetImageFileName
                                                        (imageTxId)));
         GenericTestUtils.AssertExists(new FilePath(baseDir, "current/seen_txid"));
         FilePath previous = new FilePath(baseDir, "previous");
         GenericTestUtils.AssertExists(previous);
         NUnit.Framework.Assert.AreEqual(UpgradeUtilities.ChecksumContents(HdfsServerConstants.NodeType
                                                                           .NameNode, previous, false), UpgradeUtilities.ChecksumMasterNameNodeContents());
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// For NameNode, verify that the current and/or previous exist as indicated by
 /// the method parameters.
 /// </summary>
 /// <remarks>
 /// For NameNode, verify that the current and/or previous exist as indicated by
 /// the method parameters.  If previous exists, verify that
 /// it hasn't been modified by comparing the checksum of all it's
 /// containing files with their original checksum.  It is assumed that
 /// the server has recovered.
 /// </remarks>
 /// <exception cref="System.IO.IOException"/>
 internal virtual void CheckResultNameNode(string[] baseDirs, bool currentShouldExist
                                           , bool previousShouldExist)
 {
     if (currentShouldExist)
     {
         for (int i = 0; i < baseDirs.Length; i++)
         {
             NUnit.Framework.Assert.IsTrue(new FilePath(baseDirs[i], "current").IsDirectory());
             NUnit.Framework.Assert.IsTrue(new FilePath(baseDirs[i], "current/VERSION").IsFile
                                               ());
             NUnit.Framework.Assert.IsNotNull(FSImageTestUtil.FindNewestImageFile(baseDirs[i]
                                                                                  + "/current"));
             NUnit.Framework.Assert.IsTrue(new FilePath(baseDirs[i], "current/seen_txid").IsFile
                                               ());
         }
     }
     if (previousShouldExist)
     {
         for (int i = 0; i < baseDirs.Length; i++)
         {
             NUnit.Framework.Assert.IsTrue(new FilePath(baseDirs[i], "previous").IsDirectory()
                                           );
             NUnit.Framework.Assert.AreEqual(UpgradeUtilities.ChecksumContents(HdfsServerConstants.NodeType
                                                                               .NameNode, new FilePath(baseDirs[i], "previous"), false), UpgradeUtilities.ChecksumMasterNameNodeContents
                                                 ());
         }
     }
 }