/// <exception cref="System.IO.IOException"/> public override long GetJournalCTime() { StorageInfo sInfo = new StorageInfo((HdfsServerConstants.NodeType)null); sInfo.ReadProperties(sd); return(sInfo.GetCTime()); }
/// <summary> /// Return true if this storage dir can roll back to the previous storage /// state, false otherwise. /// </summary> /// <remarks> /// Return true if this storage dir can roll back to the previous storage /// state, false otherwise. The NN will refuse to run the rollback operation /// unless at least one JM or fsimage storage directory can roll back. /// </remarks> /// <param name="storage">the storage info for the current state</param> /// <param name="prevStorage">the storage info for the previous (unupgraded) state</param> /// <param name="targetLayoutVersion">the layout version we intend to roll back to</param> /// <returns>true if this JM can roll back, false otherwise.</returns> /// <exception cref="System.IO.IOException">in the event of error</exception> internal static bool CanRollBack(Storage.StorageDirectory sd, StorageInfo storage , StorageInfo prevStorage, int targetLayoutVersion) { FilePath prevDir = sd.GetPreviousDir(); if (!prevDir.Exists()) { // use current directory then Log.Info("Storage directory " + sd.GetRoot() + " does not contain previous fs state." ); // read and verify consistency with other directories storage.ReadProperties(sd); return(false); } // read and verify consistency of the prev dir prevStorage.ReadPreviousVersionProperties(sd); if (prevStorage.GetLayoutVersion() != targetLayoutVersion) { throw new IOException("Cannot rollback to storage version " + prevStorage.GetLayoutVersion () + " using this version of the NameNode, which uses storage version " + targetLayoutVersion + ". " + "Please use the previous version of HDFS to perform the rollback."); } return(true); }