protected FSNamesystem getFSNamesystem() { return FSNamesystem.getFSNamesystem(); }
private boolean getDistributedUpgradeState() { return FSNamesystem.getFSNamesystem().getDistributedUpgradeState(); }
private int getDistributedUpgradeVersion() { return FSNamesystem.getFSNamesystem().getDistributedUpgradeVersion(); }
private void setDistributedUpgradeState(boolean uState, int uVersion) { FSNamesystem.getFSNamesystem().upgradeManager.setUpgradeState(uState, uVersion); }
private void initializeDistributedUpgrade() throws IOException { UpgradeManagerNamenode um = FSNamesystem.getFSNamesystem().upgradeManager; if(! um.initializeUpgrade()) return; // write new upgrade state into disk FSNamesystem.getFSNamesystem().getFSImage().writeAll(); NameNode.LOG.info("\n Distributed upgrade for NameNode version " + um.getUpgradeVersion() + " to current LV " + FSConstants.LAYOUT_VERSION + " is initialized."); }
public synchronized void completeUpgrade() throws IOException { // set and write new upgrade state into disk setUpgradeState(false, FSConstants.LAYOUT_VERSION); FSNamesystem.getFSNamesystem().getFSImage().writeAll(); currentUpgrades = null; broadcastCommand = null; FSNamesystem.getFSNamesystem().leaveSafeMode(false); }
static short adjustReplication(short replication) { FSNamesystem fsNamesys = FSNamesystem.getFSNamesystem(); short minReplication = fsNamesys.getMinReplication(); if (replication<minReplication) { replication = minReplication; } short maxReplication = fsNamesys.getMaxReplication(); if (replication>maxReplication) { replication = maxReplication; } return replication; }
private void verifyDistributedUpgradeProgress(StartupOption startOpt ) throws IOException { if(startOpt == StartupOption.ROLLBACK || startOpt == StartupOption.IMPORT) return; UpgradeManager um = FSNamesystem.getFSNamesystem().upgradeManager; assert um != null : "FSNameSystem.upgradeManager is null."; if(startOpt != StartupOption.UPGRADE) { if(um.getUpgradeState()) throw new IOException( "\n Previous distributed upgrade was not completed. " + "\n Please restart NameNode with -upgrade option."); if(um.getDistributedUpgrades() != null) throw new IOException("\n Distributed upgrade for NameNode version " + um.getUpgradeVersion() + " to current LV " + FSConstants.LAYOUT_VERSION + " is required.\n Please restart NameNode with -upgrade option."); } }
FSNamesystem fsNamesys = FSNamesystem.getFSNamesystem(); FSDirectory fsDir = fsNamesys.dir; long startTime = FSNamesystem.now();
/** * Start distributed upgrade. * Instantiates distributed upgrade objects. * * @return true if distributed upgrade is required or false otherwise * @throws IOException */ public synchronized boolean startUpgrade() throws IOException { if(!upgradeState) { initializeUpgrade(); if(!upgradeState) return false; // write new upgrade state into disk FSNamesystem.getFSNamesystem().getFSImage().writeAll(); } assert currentUpgrades != null : "currentUpgrades is null"; this.broadcastCommand = currentUpgrades.first().startUpgrade(); NameNode.LOG.info("\n Distributed upgrade for NameNode version " + getUpgradeVersion() + " to current LV " + FSConstants.LAYOUT_VERSION + " is started."); return true; }
public JspHelper() { if (DataNode.getDataNode() != null) { nameNodeAddr = DataNode.getDataNode().getNameNodeAddr(); } else { fsn = FSNamesystem.getFSNamesystem(); nameNodeAddr = new InetSocketAddress(fsn.getDFSNameNodeMachine(), fsn.getDFSNameNodePort()); } UnixUserGroupInformation.saveToConf(conf, UnixUserGroupInformation.UGI_PROPERTY_NAME, webUGI); }
UpgradeStatusReport distributedUpgradeProgress(UpgradeAction action ) throws IOException { boolean isFinalized = false; if(currentUpgrades == null) { // no upgrades are in progress FSImage fsimage = FSNamesystem.getFSNamesystem().getFSImage(); isFinalized = fsimage.isUpgradeFinalized(); if(isFinalized) // upgrade is finalized return null; // nothing to report return new UpgradeStatusReport(fsimage.getLayoutVersion(), (short)101, isFinalized); } UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first(); boolean details = false; switch(action) { case GET_STATUS: break; case DETAILED_STATUS: details = true; break; case FORCE_PROCEED: curUO.forceProceed(); } return curUO.getUpgradeStatusReport(details); }
assert curFile != null : "curFile is null"; FSNamesystem fsNamesys = FSNamesystem.getFSNamesystem(); FSDirectory fsDir = fsNamesys.dir; short replication = FSNamesystem.getFSNamesystem().getDefaultReplication();
/** * Load and merge edits from two edits files * * @param sd storage directory * @return number of edits loaded * @throws IOException */ int loadFSEdits(StorageDirectory sd) throws IOException { int numEdits = 0; EditLogFileInputStream edits = new EditLogFileInputStream(getImageFile(sd, NameNodeFile.EDITS)); numEdits = FSEditLog.loadFSEdits(edits); edits.close(); File editsNew = getImageFile(sd, NameNodeFile.EDITS_NEW); if (editsNew.exists() && editsNew.length() > 0) { edits = new EditLogFileInputStream(editsNew); numEdits += FSEditLog.loadFSEdits(edits); edits.close(); } // update the counts. FSNamesystem.getFSNamesystem().dir.updateCountForINodeWithQuota(); return numEdits; }
/** * Load image from a checkpoint directory and save it into the current one. * @throws IOException */ void doImportCheckpoint() throws IOException { FSImage ckptImage = new FSImage(); FSNamesystem fsNamesys = FSNamesystem.getFSNamesystem(); // replace real image with the checkpoint image FSImage realImage = fsNamesys.getFSImage(); assert realImage == this; fsNamesys.dir.fsImage = ckptImage; // load from the checkpoint dirs try { ckptImage.recoverTransitionRead(checkpointDirs, checkpointEditsDirs, StartupOption.REGULAR); } finally { ckptImage.close(); } // return back the real image realImage.setStorageInfo(ckptImage); fsNamesys.dir.fsImage = realImage; // and save it saveFSImage(); }
FSNamesystem fsNamesys = FSNamesystem.getFSNamesystem(); FSDirectory fsDir = fsNamesys.dir; int numEdits = 0;
FSNamesystem fsNameSystem = FSNamesystem.getFSNamesystem(); filesTotal.set((int)fsNameSystem.getFilesTotal()); filesTotal.pushMetric(metricsRecord);