[ 
https://issues.apache.org/jira/browse/HDFS-8418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14549658#comment-14549658
 ] 

Jing Zhao commented on HDFS-8418:
---------------------------------

bq. INodeFile#getPreferredBlockReplication is method of INodeFile, not method 
of BlockInfo

Ahh, actually you're right. We do not need to and also cannot put the same 
logic into getPreferredBlockReplication. +1 for the current patch. I will 
commit it shortly.

> Fix the isNeededReplication calculation for Striped block in NN
> ---------------------------------------------------------------
>
>                 Key: HDFS-8418
>                 URL: https://issues.apache.org/jira/browse/HDFS-8418
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Yi Liu
>            Assignee: Yi Liu
>            Priority: Critical
>         Attachments: HDFS-8418-HDFS-7285.001.patch
>
>
> Currently when calculating {{isNeededReplication}} for striped block, we use 
> BlockCollection#getPreferredBlockReplication to get expected replica number 
> for striped block. See an example:
> {code}
> public void checkReplication(BlockCollection bc) {
>     final short expected = bc.getPreferredBlockReplication();
>     for (BlockInfo block : bc.getBlocks()) {
>       final NumberReplicas n = countNodes(block);
>       if (isNeededReplication(block, expected, n.liveReplicas())) { 
>         neededReplications.add(block, n.liveReplicas(),
>             n.decommissionedAndDecommissioning(), expected);
>       } else if (n.liveReplicas() > expected) {
>         processOverReplicatedBlock(block, expected, null, null);
>       }
>     }
>   }
> {code}
> But actually it's not correct, for example, if the length of striped file is 
> less than a cell, then the expected replica of the block should be {{1 + 
> parityBlkNum}} instead of {{dataBlkNum + parityBlkNum}}. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to