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

Masatake Iwasaki commented on HDFS-9535:
----------------------------------------

Thanks for reporting this.

{code}
     final boolean b = commitBlock(lastBlock, commitBlock);
     if (hasMinStorage(lastBlock)) {
      if (b && !bc.isStriped()) {
         addExpectedReplicasToPending(lastBlock);
       }
       completeBlock(lastBlock, false);
{code}

Hmm.. If the block is committed but not satisfy {{if 
(hasMinStorage(lastBlock))}}, {{addExpectedReplicasToPending}} will never be 
called before {{completeBlock}} on the next time {{commitOrCompleteLastBlock}} 
is called from the code path of {{addBlock}} because {{commitBlock}} will 
return false for already committed block.

The {{if (b && !bc.isStriped())}} checks the return value of {{commitBlock}} in 
order to avoid adding same nodes to {{pendingReplication}} multiple times. How 
about replace the condition with another logic such as 
{{pendingReplications.getNumReplicas(lastBlock) == 0}}?


> Fix TestReplication#testNoExtraReplicationWhenBlockReceivedIsLate
> -----------------------------------------------------------------
>
>                 Key: HDFS-9535
>                 URL: https://issues.apache.org/jira/browse/HDFS-9535
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 2.8.0
>            Reporter: Jing Zhao
>            Assignee: Mingliang Liu
>            Priority: Minor
>
> TestReplication#testNoExtraReplicationWhenBlockReceivedIsLate failed in 
> several Jenkins run (e.g., 
> https://builds.apache.org/job/PreCommit-HDFS-Build/13818/testReport/). The 
> failure is on the last {{assertNoReplicationWasPerformed}} check.



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

Reply via email to