private boolean shouldReturnNextDir() { StorageDirectory sd = getStorageDir(nextIndex); return (dirType == null || sd.getStorageDirType().isOfType(dirType)) && (includeShared || !sd.isShared()); } }
/** * Read properties from the the previous/VERSION file in the given storage directory. */ public void readPreviousVersionProperties(StorageDirectory sd) throws IOException { Properties props = readPropertiesFile(sd.getPreviousVersionFile()); setFieldsFromProperties(props, sd); }
/** * Write properties to the VERSION file in the given storage directory. */ public void writeProperties(StorageDirectory sd) throws IOException { writeProperties(sd.getVersionFile(), sd); }
@Override public long getJournalCTime() throws IOException { StorageInfo sInfo = new StorageInfo((NodeType)null); sInfo.readProperties(sd); return sInfo.getCTime(); } }
/** Validate and set storage type from {@link Properties}*/ protected void checkStorageType(Properties props, StorageDirectory sd) throws InconsistentFSStateException { if (storageType == null) { //don't care about storage type return; } NodeType type = NodeType.valueOf(getProperty(props, sd, "storageType")); if (!storageType.equals(type)) { throw new InconsistentFSStateException(sd.root, "Incompatible node types: storageType=" + storageType + " but StorageDirectory type=" + type); } }
/** * Read properties from the VERSION file in the given storage directory. */ public void readProperties(StorageDirectory sd) throws IOException { Properties props = readPropertiesFile(sd.getVersionFile()); setFieldsFromProperties(props, sd); }
/** * Check if the given storage directory comes from a version of Hadoop * prior to when the directory layout changed (ie 0.13). If this is * the case, this method throws an IOException. */ private void checkOldLayoutStorage(StorageDirectory sd) throws IOException { if (isPreUpgradableLayout(sd)) { checkVersionUpgradable(0); } }
/** Validate and set namespaceID version from {@link Properties}*/ protected void setNamespaceID(Properties props, StorageDirectory sd) throws InconsistentFSStateException { int nsId = Integer.parseInt(getProperty(props, sd, "namespaceID")); if (namespaceID != 0 && nsId != 0 && namespaceID != nsId) { throw new InconsistentFSStateException(sd.root, "namespaceID is incompatible with others."); } namespaceID = nsId; }
/** * Return iterator based on Storage Directory Type * This iterator selects entries in storageDirs of type dirType and returns * them via the Iterator */ public Iterator<StorageDirectory> dirIterator(StorageDirType dirType) { return dirIterator(dirType, true); }
public void read(File from, Storage storage) throws IOException { Properties props = readPropertiesFile(from); storage.setFieldsFromProperties(props, this); }
/** Same as getUGI(context, request, conf, KERBEROS_SSL, true). */ public static UserGroupInformation getUGI(ServletContext context, HttpServletRequest request, Configuration conf) throws IOException { return getUGI(context, request, conf, AuthenticationMethod.KERBEROS_SSL, true); }
/** * @param dirType all entries will be of this type of dir * @param includeShared true to include any shared directories, * false otherwise * @return an iterator over the configured storage dirs. */ public Iterator<StorageDirectory> dirIterator(StorageDirType dirType, boolean includeShared) { return new DirIterator(dirType, includeShared); }
/** * Returns true if Namenode was started with a RollBack option. * * @param option - StartupOption * @return boolean */ private static boolean isInRollBackMode(StartupOption option) { return (option == StartupOption.ROLLBACK) || (option == StartupOption.ROLLINGUPGRADE && option.getRollingUpgradeStartupOption() == RollingUpgradeStartupOption.ROLLBACK); }
/** * Gets the current generation stamp for this filesystem */ public void setGenerationStamp(long stamp) { generationStamp.setCurrentValue(stamp); }
/** * Gets the current generation stamp for legacy blocks */ public long getLegacyGenerationStamp() { return legacyGenerationStamp.getCurrentValue(); }
public static MD5Hash doGetUrl(URL url, List<File> localPaths, Storage dstStorage, boolean getChecksum) throws IOException { return Util.doGetUrl(url, localPaths, dstStorage, getChecksum, timeout, null); }
/** * Return default iterator * This iterator returns all entries in storageDirs */ public Iterator<StorageDirectory> dirIterator() { return dirIterator(null); }
/** Same as getUGI(null, request, conf). */ public static UserGroupInformation getUGI(HttpServletRequest request, Configuration conf) throws IOException { return getUGI(null, request, conf); }
/** * Sets the current generation stamp for legacy blocks */ public void setLegacyGenerationStamp(long stamp) { legacyGenerationStamp.setCurrentValue(stamp); }
@Override public Iterator<StorageDirectory> iterator() { return dirIterator(dirType); } };