当前位置: 首页>>代码示例>>Java>>正文


Java NamenodeCommand类代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.protocol.NamenodeCommand的典型用法代码示例。如果您正苦于以下问题:Java NamenodeCommand类的具体用法?Java NamenodeCommand怎么用?Java NamenodeCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NamenodeCommand类属于org.apache.hadoop.hdfs.server.protocol包,在下文中一共展示了NamenodeCommand类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  writeLock();
  try {
    checkOperation(OperationCategory.CHECKPOINT);
    checkNameNodeSafeMode("Checkpoint not started");
    
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    NamenodeCommand cmd = getFSImage().startCheckpoint(backupNode,
        activeNamenode);
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:FSNamesystem.java

示例2: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
@Override // NamenodeProtocol
public NamenodeCommand startCheckpoint(NamenodeRegistration registration)
    throws IOException {
  checkNNStartup();
  namesystem.checkSuperuserPrivilege();
  verifyRequest(registration);
  if(!nn.isRole(NamenodeRole.NAMENODE))
    throw new IOException("Only an ACTIVE node can invoke startCheckpoint.");

  CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
    null);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return (NamenodeCommand) cacheEntry.getPayload();
  }
  NamenodeCommand ret = null;
  try {
    ret = namesystem.startCheckpoint(registration, nn.setRegistration());
  } finally {
    RetryCache.setState(cacheEntry, ret != null, ret);
  }
  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:NameNodeRpcServer.java

示例3: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  writeLock();
  try {
    checkOperation(OperationCategory.CHECKPOINT);
    checkNameNodeSafeMode("Checkpoint not started");
    
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    NamenodeCommand cmd = getFSImage().startCheckpoint(backupNode,
        activeNamenode, getEffectiveLayoutVersion());
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:FSNamesystem.java

示例4: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
      null);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return (NamenodeCommand) cacheEntry.getPayload();
  }
  writeLock();
  NamenodeCommand cmd = null;
  try {
    checkOperation(OperationCategory.CHECKPOINT);
    checkNameNodeSafeMode("Checkpoint not started");
    
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    cmd = getFSImage().startCheckpoint(backupNode, activeNamenode);
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
    RetryCache.setState(cacheEntry, cmd != null, cmd);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:FSNamesystem.java

示例5: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
      null);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return (NamenodeCommand) cacheEntry.getPayload();
  }
  writeLock();
  NamenodeCommand cmd = null;
  try {
    checkOperation(OperationCategory.CHECKPOINT);

    if (isInSafeMode()) {
      throw new SafeModeException("Checkpoint not started", safeMode);
    }
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    cmd = getFSImage().startCheckpoint(backupNode, activeNamenode);
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
    RetryCache.setState(cacheEntry, cmd != null, cmd);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:FSNamesystem.java

示例6: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
/**
 * Start checkpoint.
 * <p>
 * If backup storage contains image that is newer than or incompatible with 
 * what the active name-node has, then the backup node should shutdown.<br>
 * If the backup image is older than the active one then it should 
 * be discarded and downloaded from the active node.<br>
 * If the images are the same then the backup image will be used as current.
 * 
 * @param bnReg the backup node registration.
 * @param nnReg this (active) name-node registration.
 * @return {@link NamenodeCommand} if backup node should shutdown or
 * {@link CheckpointCommand} prescribing what backup node should 
 *         do with its image.
 * @throws IOException
 */
NamenodeCommand startCheckpoint(NamenodeRegistration bnReg, // backup node
                                NamenodeRegistration nnReg) // active name-node
throws IOException {
  LOG.info("Start checkpoint at txid " + getEditLog().getLastWrittenTxId());
  String msg = null;
  // Verify that checkpoint is allowed
  if(bnReg.getNamespaceID() != storage.getNamespaceID())
    msg = "Name node " + bnReg.getAddress()
          + " has incompatible namespace id: " + bnReg.getNamespaceID()
          + " expected: " + storage.getNamespaceID();
  else if(bnReg.isRole(NamenodeRole.NAMENODE))
    msg = "Name node " + bnReg.getAddress()
          + " role " + bnReg.getRole() + ": checkpoint is not allowed.";
  else if(bnReg.getLayoutVersion() < storage.getLayoutVersion()
      || (bnReg.getLayoutVersion() == storage.getLayoutVersion()
          && bnReg.getCTime() > storage.getCTime()))
    // remote node has newer image age
    msg = "Name node " + bnReg.getAddress()
          + " has newer image layout version: LV = " +bnReg.getLayoutVersion()
          + " cTime = " + bnReg.getCTime()
          + ". Current version: LV = " + storage.getLayoutVersion()
          + " cTime = " + storage.getCTime();
  if(msg != null) {
    LOG.error(msg);
    return new NamenodeCommand(NamenodeProtocol.ACT_SHUTDOWN);
  }
  boolean needToReturnImg = true;
  if(storage.getNumStorageDirs(NameNodeDirType.IMAGE) == 0)
    // do not return image if there are no image directories
    needToReturnImg = false;
  CheckpointSignature sig = rollEditLog();
  return new CheckpointCommand(sig, needToReturnImg);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:FSImage.java

示例7: convert

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
public static NamenodeCommandProto convert(NamenodeCommand cmd) {
  if (cmd instanceof CheckpointCommand) {
    return NamenodeCommandProto.newBuilder().setAction(cmd.getAction())
        .setType(NamenodeCommandProto.Type.CheckPointCommand)
        .setCheckpointCmd(convert((CheckpointCommand) cmd)).build();
  }
  return NamenodeCommandProto.newBuilder()
      .setType(NamenodeCommandProto.Type.NamenodeCommand)
      .setAction(cmd.getAction()).build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:PBHelper.java

示例8: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
@Override
public StartCheckpointResponseProto startCheckpoint(RpcController unused,
    StartCheckpointRequestProto request) throws ServiceException {
  NamenodeCommand cmd;
  try {
    cmd = impl.startCheckpoint(PBHelper.convert(request.getRegistration()));
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return StartCheckpointResponseProto.newBuilder()
      .setCommand(PBHelper.convert(cmd)).build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:NamenodeProtocolServerSideTranslatorPB.java

示例9: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
@Override
public NamenodeCommand startCheckpoint(NamenodeRegistration registration)
    throws IOException {
  StartCheckpointRequestProto req = StartCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration)).build();
  NamenodeCommandProto cmd;
  try {
    cmd = rpcProxy.startCheckpoint(NULL_CONTROLLER, req).getCommand();
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  return PBHelper.convert(cmd);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:NamenodeProtocolTranslatorPB.java

示例10: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
/**
 * Start checkpoint.
 * <p>
 * If backup storage contains image that is newer than or incompatible with 
 * what the active name-node has, then the backup node should shutdown.<br>
 * If the backup image is older than the active one then it should 
 * be discarded and downloaded from the active node.<br>
 * If the images are the same then the backup image will be used as current.
 * 
 * @param bnReg the backup node registration.
 * @param nnReg this (active) name-node registration.
 * @return {@link NamenodeCommand} if backup node should shutdown or
 * {@link CheckpointCommand} prescribing what backup node should 
 *         do with its image.
 * @throws IOException
 */
NamenodeCommand startCheckpoint(NamenodeRegistration bnReg, // backup node
                                NamenodeRegistration nnReg,
                                int layoutVersion) // active name-node
throws IOException {
  LOG.info("Start checkpoint at txid " + getEditLog().getLastWrittenTxId());
  String msg = null;
  // Verify that checkpoint is allowed
  if(bnReg.getNamespaceID() != storage.getNamespaceID())
    msg = "Name node " + bnReg.getAddress()
          + " has incompatible namespace id: " + bnReg.getNamespaceID()
          + " expected: " + storage.getNamespaceID();
  else if(bnReg.isRole(NamenodeRole.NAMENODE))
    msg = "Name node " + bnReg.getAddress()
          + " role " + bnReg.getRole() + ": checkpoint is not allowed.";
  else if(bnReg.getLayoutVersion() < storage.getLayoutVersion()
      || (bnReg.getLayoutVersion() == storage.getLayoutVersion()
          && bnReg.getCTime() > storage.getCTime()))
    // remote node has newer image age
    msg = "Name node " + bnReg.getAddress()
          + " has newer image layout version: LV = " +bnReg.getLayoutVersion()
          + " cTime = " + bnReg.getCTime()
          + ". Current version: LV = " + storage.getLayoutVersion()
          + " cTime = " + storage.getCTime();
  if(msg != null) {
    LOG.error(msg);
    return new NamenodeCommand(NamenodeProtocol.ACT_SHUTDOWN);
  }
  boolean needToReturnImg = true;
  if(storage.getNumStorageDirs(NameNodeDirType.IMAGE) == 0)
    // do not return image if there are no image directories
    needToReturnImg = false;
  CheckpointSignature sig = rollEditLog(layoutVersion);
  return new CheckpointCommand(sig, needToReturnImg);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:51,代码来源:FSImage.java

示例11: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
@Override // NamenodeProtocol
public NamenodeCommand startCheckpoint(NamenodeRegistration registration)
    throws IOException {
  checkNNStartup();
  namesystem.checkSuperuserPrivilege();
  verifyRequest(registration);
  if(!nn.isRole(NamenodeRole.NAMENODE))
    throw new IOException("Only an ACTIVE node can invoke startCheckpoint.");
  return namesystem.startCheckpoint(registration, nn.setRegistration());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:11,代码来源:NameNodeRpcServer.java

示例12: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; //导入依赖的package包/类
@Override // NamenodeProtocol
public NamenodeCommand startCheckpoint(NamenodeRegistration registration)
throws IOException {
  namesystem.checkSuperuserPrivilege();
  verifyRequest(registration);
  if(!nn.isRole(NamenodeRole.NAMENODE))
    throw new IOException("Only an ACTIVE node can invoke startCheckpoint.");
  return namesystem.startCheckpoint(registration, nn.setRegistration());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:10,代码来源:NameNodeRpcServer.java


注:本文中的org.apache.hadoop.hdfs.server.protocol.NamenodeCommand类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。