private int getNumStorageDirs() { int numStorageDirs = 0; for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext(); it.next()) numStorageDirs++; return numStorageDirs; }
private int getNumStorageDirs() { int numStorageDirs = 0; for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext(); it.next()) numStorageDirs++; return numStorageDirs; }
File[] getFileNames(NameNodeFile type, NameNodeDirType dirType) { ArrayList<File> list = new ArrayList<File>(); Iterator<StorageDirectory> it = (dirType == null) ? dirIterator() : dirIterator(dirType); for ( ;it.hasNext(); ) { list.add(getImageFile(it.next(), type)); } return list.toArray(new File[list.size()]); }
File[] getFileNames(NameNodeFile type, NameNodeDirType dirType) { ArrayList<File> list = new ArrayList<File>(); Iterator<StorageDirectory> it = (dirType == null) ? dirIterator() : dirIterator(dirType); for ( ;it.hasNext(); ) { list.add(getImageFile(it.next(), type)); } return list.toArray(new File[list.size()]); }
/** * Return the name of the image file that is uploaded by periodic * checkpointing. */ File[] getFsImageNameCheckpoint() { ArrayList<File> list = new ArrayList<File>(); for (Iterator<StorageDirectory> it = dirIterator(NameNodeDirType.IMAGE); it.hasNext();) { list.add(getImageFile(it.next(), NameNodeFile.IMAGE_NEW)); } return list.toArray(new File[list.size()]); }
/** * Remove storage directory given directory */ void processIOError(File dirName) { for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); if (sd.getRoot().getPath().equals(dirName.getParent())) it.remove(); } }
/** * check if ANY edits.new log exists */ boolean existsNew() throws IOException { for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext();) { if (getEditNewFile(it.next()).exists()) { return true; } } return false; }
/** * check if ANY edits.new log exists */ boolean existsNew() throws IOException { for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext();) { if (getEditNewFile(it.next()).exists()) { return true; } } return false; }
/** * Return the name of the image file that is uploaded by periodic * checkpointing. */ File[] getFsImageNameCheckpoint() { ArrayList<File> list = new ArrayList<File>(); for (Iterator<StorageDirectory> it = dirIterator(NameNodeDirType.IMAGE); it.hasNext();) { list.add(getImageFile(it.next(), NameNodeFile.IMAGE_NEW)); } return list.toArray(new File[list.size()]); }
File getFsTimeName() { StorageDirectory sd = null; // NameNodeFile.TIME shoul be same on all directories for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) sd = it.next(); return getImageFile(sd, NameNodeFile.TIME); }
/** * Return the name of the image file. */ File getFsImageName() { StorageDirectory sd = null; for (Iterator<StorageDirectory> it = dirIterator(NameNodeDirType.IMAGE); it.hasNext();) sd = it.next(); return getImageFile(sd, NameNodeFile.IMAGE); }
/** * Returns the timestamp of the edit log */ synchronized long getFsEditTime() { Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); if(it.hasNext()) return getEditFile(it.next()).lastModified(); return 0; }
/** * Return the name of the edit file */ synchronized File getFsEditName() throws IOException { StorageDirectory sd = null; for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext();) sd = it.next(); return getEditFile(sd); }
/** * Returns the timestamp of the edit log */ synchronized long getFsEditTime() { Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); if(it.hasNext()) return getEditFile(it.next()).lastModified(); return 0; }
File getFsTimeName() { StorageDirectory sd = null; // NameNodeFile.TIME shoul be same on all directories for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) sd = it.next(); return getImageFile(sd, NameNodeFile.TIME); }
/** * Create edits.new if non existent. */ synchronized void createNewIfMissing() throws IOException { for (Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS); it.hasNext();) { File newFile = getEditNewFile(it.next()); if (!newFile.exists()) createEditLogFile(newFile); } }
/** * Deletes the checkpoint file in every storage directory, * since the checkpoint was cancelled. Moves lastcheckpoint.tmp -> current */ private void deleteCancelledCheckpoint() throws IOException { ArrayList<StorageDirectory> errorDirs = new ArrayList<StorageDirectory>(); for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); deleteCancelledChecpointDir(sd, errorDirs); } processIOError(errorDirs); }
void finalizeUpgrade() throws IOException { for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) { doFinalize(it.next()); } isUpgradeFinalized = true; namesystem.setUpgradeStartTime(0); }
public void format() throws IOException { this.layoutVersion = FSConstants.LAYOUT_VERSION; this.namespaceID = newNamespaceID(); this.cTime = 0L; this.checkpointTime = FSNamesystem.now(); for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); format(sd); } }
public void format() throws IOException { this.layoutVersion = FSConstants.LAYOUT_VERSION; this.namespaceID = newNamespaceID(); this.cTime = 0L; this.checkpointTime = FSNamesystem.now(); for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); format(sd); } }