hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yongjun Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-6577) Failure to create FinalizeCommand
Date Fri, 20 Jun 2014 14:31:26 GMT
Yongjun Zhang created HDFS-6577:

             Summary: Failure to create FinalizeCommand
                 Key: HDFS-6577
                 URL: https://issues.apache.org/jira/browse/HDFS-6577
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: namenode
    Affects Versions: 2.4.0
            Reporter: Yongjun Zhang
            Assignee: Yongjun Zhang

I visually see a bug in NameNodeRpcServer.java, 
 @Override // DatanodeProtocol
  public DatanodeCommand blockReport(DatanodeRegistration nodeReg,
      String poolId, StorageBlockReport[] reports) throws IOException {
    if(blockStateChangeLog.isDebugEnabled()) {
      blockStateChangeLog.debug("*BLOCK* NameNode.blockReport: "
           + "from " + nodeReg + ", reports.length=" + reports.length);
    final BlockManager bm = namesystem.getBlockManager();
    boolean noStaleStorages = false;
    for(StorageBlockReport r : reports) {
      final BlockListAsLongs blocks = new BlockListAsLongs(r.getBlocks());
      noStaleStorages = bm.processReport(nodeReg, r.getStorage(), poolId, blocks);

    if (nn.getFSImage().isUpgradeFinalized() &&
        !nn.isStandbyState() &&
        noStaleStorages) {
      return new FinalizeCommand(poolId);

    return null;

noStaleStorage is initialized to false, then in the for loop {{ for(StorageBlockReport r :
reports) {}} it could be changed to true. 

The problem is, since it's a loop of all reports, the value returned from the last blockreport
(the last iteration) will set it to the final value. Even if it was set to true in the middle
of a loop, the final iteration could overwrite it to false.

This message was sent by Atlassian JIRA

View raw message