You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Arpit Agarwal (JIRA)" <ji...@apache.org> on 2014/06/20 18:57:25 UTC

[jira] [Resolved] (HDFS-6577) Failure to create FinalizeCommand

     [ https://issues.apache.org/jira/browse/HDFS-6577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arpit Agarwal resolved HDFS-6577.
---------------------------------

    Resolution: Not a Problem

Resolving, feel free to respond if you disagree.

> 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, 
> {code}
>  @Override // DatanodeProtocol
>   public DatanodeCommand blockReport(DatanodeRegistration nodeReg,
>       String poolId, StorageBlockReport[] reports) throws IOException {
>     verifyRequest(nodeReg);
>     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);
>       metrics.incrStorageBlockReportOps();
>     }
>     if (nn.getFSImage().isUpgradeFinalized() &&
>         !nn.isStandbyState() &&
>         noStaleStorages) {
>       return new FinalizeCommand(poolId);
>     }
>     return null;
>   }
> {code}
> 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. Similarly, if it was set to false in the middle, and the final iter could overwrite it to true.



--
This message was sent by Atlassian JIRA
(v6.2#6252)