Exemple #1
0
 /// <summary>
 /// For block pool, verify that the current and/or previous exist as indicated
 /// by the method parameters.
 /// </summary>
 /// <remarks>
 /// For block pool, 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>
 /// <param name="baseDirs">directories pointing to block pool storage</param>
 /// <param name="bpid">block pool Id</param>
 /// <param name="currentShouldExist">current directory exists under storage</param>
 /// <param name="currentShouldExist">previous directory exists under storage</param>
 /// <exception cref="System.IO.IOException"/>
 internal virtual void CheckResultBlockPool(string[] baseDirs, bool currentShouldExist
                                            , bool previousShouldExist)
 {
     if (currentShouldExist)
     {
         for (int i = 0; i < baseDirs.Length; i++)
         {
             FilePath bpCurDir = new FilePath(baseDirs[i], Storage.StorageDirCurrent);
             NUnit.Framework.Assert.AreEqual(UpgradeUtilities.ChecksumContents(HdfsServerConstants.NodeType
                                                                               .DataNode, bpCurDir, false), UpgradeUtilities.ChecksumMasterBlockPoolContents());
         }
     }
     if (previousShouldExist)
     {
         for (int i = 0; i < baseDirs.Length; i++)
         {
             FilePath bpPrevDir = new FilePath(baseDirs[i], Storage.StorageDirPrevious);
             NUnit.Framework.Assert.IsTrue(bpPrevDir.IsDirectory());
             NUnit.Framework.Assert.AreEqual(UpgradeUtilities.ChecksumContents(HdfsServerConstants.NodeType
                                                                               .DataNode, bpPrevDir, false), UpgradeUtilities.ChecksumMasterBlockPoolContents()
                                             );
         }
     }
 }