示例#1
0
 /// <summary>
 /// Sets up the storage directories for a block pool under
 /// <see cref="DFSConfigKeys.DfsDatanodeDataDirKey"/>
 /// . For each element
 /// in
 /// <see cref="DFSConfigKeys.DfsDatanodeDataDirKey"/>
 /// , the subdirectories
 /// represented by the first four elements of the <code>state</code> array
 /// will be created and populated.
 /// See
 /// <see cref="UpgradeUtilities.CreateBlockPoolStorageDirs(string[], string, string)"
 ///     />
 /// </summary>
 /// <param name="bpid">block pool Id</param>
 /// <param name="state">
 /// a row from the testCases table which indicates which directories
 /// to setup for the node
 /// </param>
 /// <returns>file paths representing block pool storage directories</returns>
 /// <exception cref="System.Exception"/>
 internal virtual string[] CreateBlockPoolStorageState(string bpid, bool[] state)
 {
     string[] baseDirs = conf.GetStrings(DFSConfigKeys.DfsDatanodeDataDirKey);
     UpgradeUtilities.CreateEmptyDirs(baseDirs);
     UpgradeUtilities.CreateDataNodeStorageDirs(baseDirs, "current");
     // After copying the storage directories from master datanode, empty
     // the block pool storage directories
     string[] bpDirs = UpgradeUtilities.CreateEmptyBPDirs(baseDirs, bpid);
     if (state[CurrentExists])
     {
         // current
         UpgradeUtilities.CreateBlockPoolStorageDirs(baseDirs, "current", bpid);
     }
     if (state[PreviousExists])
     {
         // previous
         UpgradeUtilities.CreateBlockPoolStorageDirs(baseDirs, "previous", bpid);
     }
     if (state[PreviousTmpExists])
     {
         // previous.tmp
         UpgradeUtilities.CreateBlockPoolStorageDirs(baseDirs, "previous.tmp", bpid);
     }
     if (state[RemovedTmpExists])
     {
         // removed.tmp
         UpgradeUtilities.CreateBlockPoolStorageDirs(baseDirs, "removed.tmp", bpid);
     }
     return(bpDirs);
 }