/** @return blocks with locations. */ public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size, long minBlockSize) throws IOException { return namenode.getBlocks(datanode, size, minBlockSize); }
@Override protected Void doWork() throws IOException { cachedActiveProxy.rollEditLog(); return null; } };
@Override public void run() { try { while (shouldRun) { try { blockTokenSecretManager.addKeys(namenode.getBlockKeys()); } catch (IOException e) { LOG.error("Failed to set keys", e); } Thread.sleep(sleepInterval); } } catch (InterruptedException e) { LOG.debug("InterruptedException in block key updater thread", e); } catch (Throwable e) { LOG.error("Exception in block key updater thread", e); shouldRun = false; } }
nsInfo = proxy.versionRequest(); isUpgradeFinalized = proxy.isUpgradeFinalized(); break; } catch (IOException ioe) {
final long imageTxId = proxy.getMostRecentCheckpointTxId(); final long curTxId = proxy.getTransactionID(); FSImage image = new FSImage(conf); try {
CheckpointSignature sig = namenode.rollEditLog(); namenode.getEditLogManifest(sig.mostRecentCheckpointTxId + 1);
getRemoteNamenodeProxy().startCheckpoint(backupNode.getRegistration()); CheckpointCommand cpCmd = null; switch(cmd.getAction()) { LOG.debug("Doing checkpoint. Last applied: " + lastApplied); RemoteEditLogManifest manifest = getRemoteNamenodeProxy().getEditLogManifest(bnImage.getLastAppliedTxId() + 1); if (!backupNode.namenode.isRollingUpgrade()) { bnImage.updateStorageVersion(); getRemoteNamenodeProxy().endCheckpoint(backupNode.getRegistration(), sig);
getRemoteNamenodeProxy().startCheckpoint(backupNode.getRegistration()); CheckpointCommand cpCmd = null; switch(cmd.getAction()) { LOG.debug("Doing checkpoint. Last applied: " + lastApplied); RemoteEditLogManifest manifest = getRemoteNamenodeProxy().getEditLogManifest(bnImage.getLastAppliedTxId() + 1); getRemoteNamenodeProxy().endCheckpoint(backupNode.getRegistration(), sig);
private static NamespaceInfo handshake(NamenodeProtocol namenode) throws IOException, SocketTimeoutException { NamespaceInfo nsInfo; nsInfo = namenode.versionRequest(); // throws SocketTimeoutException String errorMsg = null; // verify build version if( ! nsInfo.getBuildVersion().equals( Storage.getBuildVersion())) { errorMsg = "Incompatible build versions: active name-node BV = " + nsInfo.getBuildVersion() + "; backup node BV = " + Storage.getBuildVersion(); LOG.error(errorMsg); throw new IOException(errorMsg); } assert HdfsServerConstants.NAMENODE_LAYOUT_VERSION == nsInfo.getLayoutVersion() : "Active and backup node layout versions must be the same. Expected: " + HdfsServerConstants.NAMENODE_LAYOUT_VERSION + " actual "+ nsInfo.getLayoutVersion(); return nsInfo; }
CheckpointSignature sig = (CheckpointSignature)namenode.rollEditLog(); namenode.rollFsImage(new CheckpointSignature(checkpointImage)); checkpointImage.endCheckpoint();
private long countUncheckpointedTxns() throws IOException { long curTxId = namenode.getTransactionID(); long uncheckpointedTxns = curTxId - checkpointImage.getStorage().getMostRecentCheckpointTxId(); assert uncheckpointedTxns >= 0; return uncheckpointedTxns; }
@Override public GetEditLogManifestResponseProto getEditLogManifest( RpcController unused, GetEditLogManifestRequestProto request) throws ServiceException { RemoteEditLogManifest manifest; try { manifest = impl.getEditLogManifest(request.getSinceTxId()); } catch (IOException e) { throw new ServiceException(e); } return GetEditLogManifestResponseProto.newBuilder() .setManifest(PBHelper.convert(manifest)).build(); }
@Override public ErrorReportResponseProto errorReport(RpcController unused, ErrorReportRequestProto request) throws ServiceException { try { impl.errorReport(PBHelper.convert(request.getRegistration()), request.getErrorCode(), request.getMsg()); } catch (IOException e) { throw new ServiceException(e); } return VOID_ERROR_REPORT_RESPONSE; }
/** * @return true if an upgrade is in progress, false if not. * @throws IOException */ public boolean isUpgrading() throws IOException { // fsimage upgrade final boolean isUpgrade = !namenode.isUpgradeFinalized(); // rolling upgrade RollingUpgradeInfo info = fs.rollingUpgrade( HdfsConstants.RollingUpgradeAction.QUERY); final boolean isRollingUpgrade = (info != null && !info.isFinalized()); return (isUpgrade || isRollingUpgrade); }
@Override public EndCheckpointResponseProto endCheckpoint(RpcController unused, EndCheckpointRequestProto request) throws ServiceException { try { impl.endCheckpoint(PBHelper.convert(request.getRegistration()), PBHelper.convert(request.getSignature())); } catch (IOException e) { throw new ServiceException(e); } return VOID_END_CHECKPOINT_RESPONSE; }
@Override public GetMostRecentCheckpointTxIdResponseProto getMostRecentCheckpointTxId( RpcController unused, GetMostRecentCheckpointTxIdRequestProto request) throws ServiceException { long txid; try { txid = impl.getMostRecentCheckpointTxId(); } catch (IOException e) { throw new ServiceException(e); } return GetMostRecentCheckpointTxIdResponseProto.newBuilder().setTxId(txid).build(); }
CheckpointSignature sig = namenode.rollEditLog(); namenode.getEditLogManifest(sig.mostRecentCheckpointTxId + 1);
getRemoteNamenodeProxy().startCheckpoint(backupNode.getRegistration()); CheckpointCommand cpCmd = null; switch(cmd.getAction()) { LOG.debug("Doing checkpoint. Last applied: " + lastApplied); RemoteEditLogManifest manifest = getRemoteNamenodeProxy().getEditLogManifest(bnImage.getLastAppliedTxId() + 1); getRemoteNamenodeProxy().endCheckpoint(backupNode.getRegistration(), sig);
public NameNodeConnector(String name, URI nameNodeUri, Path idPath, List<Path> targetPaths, Configuration conf, int maxNotChangedIterations) throws IOException { this.nameNodeUri = nameNodeUri; this.idPath = idPath; this.targetPaths = targetPaths == null || targetPaths.isEmpty() ? Arrays .asList(new Path("/")) : targetPaths; this.maxNotChangedIterations = maxNotChangedIterations; this.namenode = NameNodeProxies.createProxy(conf, nameNodeUri, NamenodeProtocol.class).getProxy(); this.client = NameNodeProxies.createProxy(conf, nameNodeUri, ClientProtocol.class, fallbackToSimpleAuth).getProxy(); this.fs = (DistributedFileSystem)FileSystem.get(nameNodeUri, conf); final NamespaceInfo namespaceinfo = namenode.versionRequest(); this.blockpoolID = namespaceinfo.getBlockPoolID(); final FsServerDefaults defaults = fs.getServerDefaults(new Path("/")); this.keyManager = new KeyManager(blockpoolID, namenode, defaults.getEncryptDataTransfer(), conf); // if it is for test, we do not create the id file if (checkOtherInstanceRunning) { out = checkAndMarkRunning(); if (out == null) { // Exit if there is another one running. throw new IOException("Another " + name + " is running."); } } }
boolean isUpgradeFinalized; try { nsInfo = proxy.versionRequest(); isUpgradeFinalized = proxy.isUpgradeFinalized(); } catch (IOException ioe) { LOG.fatal("Unable to fetch namespace information from active NN at " +