Java 类org.apache.hadoop.hdfs.server.protocol.UpgradeCommand 实例源码

项目:hadoop-EAR    文件:TestDistributedUpgrade.java   
public void doUpgrade() throws IOException {
  this.status = (short)100;
  DataNode datanode = getDatanode();
  datanode.getNSNamenode(datanode.getAllNamespaces()[0]).processUpgradeCommand(
      new UpgradeCommand(UpgradeCommand.UC_ACTION_REPORT_STATUS, 
          getVersion(), getUpgradeStatus()));
}
项目:hadoop-EAR    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:hadoop-EAR    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
      + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
      + command.getAction() + " status = " + getUpgradeStatus() + "%");
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:hadoop-EAR    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.getDatanodeInfo() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:hadoop-on-lustre    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:hadoop-on-lustre    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
      + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
      + command.getAction() + " status = " + getUpgradeStatus() + "%");
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:hadoop-on-lustre    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.dnRegistration.getName() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:cumulus    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  if(NameNode.LOG.isDebugEnabled()) {
    NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
        + getUpgradeVersion() + " to current LV " 
        + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
        + command.getAction() + " status = " + getUpgradeStatus() + "%");
  }
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:cumulus    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.dnRegistration.getName() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:cumulus    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:RDFS    文件:TestDistributedUpgrade.java   
public void doUpgrade() throws IOException {
  this.status = (short)100;
  DataNode datanode = getDatanode();
  datanode.getNSNamenode(datanode.getAllNamespaces()[0]).processUpgradeCommand(
      new UpgradeCommand(UpgradeCommand.UC_ACTION_REPORT_STATUS, 
          getVersion(), getUpgradeStatus()));
}
项目:RDFS    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:RDFS    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
      + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
      + command.getAction() + " status = " + getUpgradeStatus() + "%");
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:RDFS    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.getDatanodeInfo() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:hadoop-0.20    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:hadoop-0.20    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
      + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
      + command.getAction() + " status = " + getUpgradeStatus() + "%");
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:hadoop-0.20    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.dnRegistration.getName() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:hortonworks-extension    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:hortonworks-extension    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
      + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
      + command.getAction() + " status = " + getUpgradeStatus() + "%");
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:hortonworks-extension    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.dnRegistration.getName() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:hortonworks-extension    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:hortonworks-extension    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
      + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
      + command.getAction() + " status = " + getUpgradeStatus() + "%");
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:hortonworks-extension    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.dnRegistration.getName() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:hadoop-gpu    文件:TestDistributedUpgrade.java   
synchronized public UpgradeCommand processUpgradeCommand(
                                UpgradeCommand command) throws IOException {
  switch(command.getAction()) {
    case UpgradeCommand.UC_ACTION_REPORT_STATUS:
      this.status += command.getCurrentStatus()/8;  // 4 reports needed
      break;
    default:
      this.status++;
  }
  return null;
}
项目:hadoop-gpu    文件:UpgradeManagerNamenode.java   
synchronized UpgradeCommand processUpgradeCommand(UpgradeCommand command
                                                  ) throws IOException {
  NameNode.LOG.debug("\n   Distributed upgrade for NameNode version " 
      + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is processing upgrade command: "
      + command.getAction() + " status = " + getUpgradeStatus() + "%");
  if(currentUpgrades == null) {
    NameNode.LOG.info("Ignoring upgrade command: " 
        + command.getAction() + " version " + command.getVersion()
        + ". No distributed upgrades are currently running on the NameNode");
    return null;
  }
  UpgradeObjectNamenode curUO = (UpgradeObjectNamenode)currentUpgrades.first();
  if(command.getVersion() != curUO.getVersion())
    throw new IncorrectVersionException(command.getVersion(), 
        "UpgradeCommand", curUO.getVersion());
  UpgradeCommand reply = curUO.processUpgradeCommand(command);
  if(curUO.getUpgradeStatus() < 100) {
    return reply;
  }
  // current upgrade is done
  curUO.completeUpgrade();
  NameNode.LOG.info("\n   Distributed upgrade for NameNode version " 
      + curUO.getVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " is complete.");
  // proceede with the next one
  currentUpgrades.remove(curUO);
  if(currentUpgrades.isEmpty()) { // all upgrades are done
    completeUpgrade();
  } else {  // start next upgrade
    curUO = (UpgradeObjectNamenode)currentUpgrades.first();
    this.broadcastCommand = curUO.startUpgrade();
  }
  return reply;
}
项目:hadoop-gpu    文件:UpgradeManagerDatanode.java   
synchronized void processUpgradeCommand(UpgradeCommand command
                                        ) throws IOException {
  assert command.getAction() == UpgradeCommand.UC_ACTION_START_UPGRADE :
    "Only start upgrade action can be processed at this time.";
  this.upgradeVersion = command.getVersion();
  // Start distributed upgrade
  if(startUpgrade()) // upgrade started
    return;
  throw new IOException(
      "Distributed upgrade for DataNode " + dataNode.dnRegistration.getName() 
      + " version " + getUpgradeVersion() + " to current LV " 
      + FSConstants.LAYOUT_VERSION + " cannot be started. "
      + "The upgrade object is not defined.");
}
项目:hadoop-EAR    文件:TestDistributedUpgrade.java   
public UpgradeCommand startUpgrade() throws IOException {
  return null;
}
项目:hadoop-EAR    文件:TestDistributedUpgrade.java   
public UpgradeCommand completeUpgrade() throws IOException {
  return null;
}
项目:hadoop-EAR    文件:AvatarDataNode.java   
public void processUpgradeCommand(UpgradeCommand comm)
throws IOException {
  assert upgradeManager != null : "DataNode.upgradeManager is null.";
  upgradeManager.processUpgradeCommand(comm);
}
项目:hadoop-EAR    文件:NameNode.java   
public UpgradeCommand processUpgradeCommand(UpgradeCommand comm) throws IOException {
  return namesystem.processDistributedUpgradeCommand(comm);
}
项目:hadoop-EAR    文件:UpgradeObjectNamenode.java   
/**
 */
public UpgradeCommand startUpgrade() throws IOException {
  // broadcast that data-nodes must start the upgrade
  return new UpgradeCommand(UpgradeCommand.UC_ACTION_START_UPGRADE,
                            getVersion(), (short)0);
}
项目:hadoop-EAR    文件:FSNamesystem.java   
UpgradeCommand processDistributedUpgradeCommand(UpgradeCommand comm)
  throws IOException {
  return upgradeManager.processUpgradeCommand(comm);
}
项目:hadoop-EAR    文件:FSNamesystem.java   
UpgradeCommand getDistributedUpgradeCommand() throws IOException {
  return upgradeManager.getBroadcastCommand();
}
项目:hadoop-EAR    文件:DataNode.java   
/**
 *
 * @param cmd
 * @return true if further processing may be required or false otherwise.
 * @throws IOException
 */
 private boolean processCommand(DatanodeCommand cmd, long processStartTime)
     throws IOException {
  if (cmd == null)
    return true;
  final BlockCommand bcmd = cmd instanceof BlockCommand? (BlockCommand)cmd: null;

  boolean retValue = true;
  long startTime = System.currentTimeMillis();

  switch(cmd.getAction()) {
  case DatanodeProtocol.DNA_TRANSFER:
    // Send a copy of a block to another datanode
    transferBlocks(namespaceId,
        bcmd.getBlocks(), bcmd.getTargets());
    myMetrics.blocksReplicated.inc(bcmd.getBlocks().length);
    break;
  case DatanodeProtocol.DNA_INVALIDATE:
    //
    // Some local block(s) are obsolete and can be 
    // safely garbage-collected.
    //
    Block toDelete[] = bcmd.getBlocks();
    try {
      if (blockScanner != null) {
        blockScanner.deleteBlocks(namespaceId, toDelete);
      }        
      data.invalidate(namespaceId, toDelete);
    } catch(IOException e) {
      checkDiskError();
      throw e;
    }
    myMetrics.blocksRemoved.inc(toDelete.length);
    break;
  case DatanodeProtocol.DNA_SHUTDOWN:
    // shut down the data node
    shouldServiceRun = false;
    retValue = false;
    break;
  case DatanodeProtocol.DNA_REGISTER:
    // namenode requested a registration - at start or if NN lost contact
    LOG.info("DatanodeCommand action: DNA_REGISTER");
    if (shouldRun) {
      register();
      firstBlockReportSent = false;
    }
    break;
  case DatanodeProtocol.DNA_FINALIZE:
     storage.finalizedUpgrade(namespaceId);
    break;
  case UpgradeCommand.UC_ACTION_START_UPGRADE:
    // start distributed upgrade here
    processDistributedUpgradeCommand((UpgradeCommand)cmd);
    break;
  case DatanodeProtocol.DNA_RECOVERBLOCK:
     recoverBlocks(namespaceId, bcmd.getBlocks(), bcmd.getTargets(),
         processStartTime);
    break;
  case DatanodeProtocol.DNA_RAIDTASK:
    processRaidTaskCommand((RaidTaskCommand) cmd);
    break;
  default:
    LOG.warn("Unknown DatanodeCommand action: " + cmd.getAction());
  }
  long endTime = System.currentTimeMillis();
  if (endTime - startTime > 1000) {
    LOG.info("processCommand() took " + (endTime - startTime)
        + " msec to process command " + cmd.getAction() + " from " + nnAddr);
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("processCommand() took " + (endTime - startTime)
        + " msec to process command " + cmd.getAction() + " from " + nnAddr);
  }
  return retValue;
}
项目:hadoop-EAR    文件:DataNode.java   
private void processDistributedUpgradeCommand(UpgradeCommand comm
                                             ) throws IOException {
  assert upgradeManager != null : "DataNode.upgradeManager is null.";
  upgradeManager.processUpgradeCommand(comm);
}
项目:hadoop-EAR    文件:UpgradeManager.java   
public synchronized UpgradeCommand getBroadcastCommand() {
  return this.broadcastCommand;
}
项目:hadoop-on-lustre    文件:TestDistributedUpgrade.java   
public void doUpgrade() throws IOException {
  this.status = (short)100;
  getDatanode().namenode.processUpgradeCommand(
      new UpgradeCommand(UpgradeCommand.UC_ACTION_REPORT_STATUS, 
          getVersion(), getUpgradeStatus()));
}
项目:hadoop-on-lustre    文件:TestDistributedUpgrade.java   
public UpgradeCommand startUpgrade() throws IOException {
  return null;
}
项目:hadoop-on-lustre    文件:TestDistributedUpgrade.java   
public UpgradeCommand completeUpgrade() throws IOException {
  return null;
}
项目:hadoop-on-lustre    文件:NameNode.java   
public UpgradeCommand processUpgradeCommand(UpgradeCommand comm) throws IOException {
  return namesystem.processDistributedUpgradeCommand(comm);
}