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

Mingliang Liu commented on HDFS-9535:
-------------------------------------

Thanks [~jingzhao] and [~iwasakims] for your comments. The guarantee 
[~jingzhao] proposed in {{addStoredBlock}} makes sense to me. So we can add the 
just completed replicas to pending queue in order to avoiding under-replication 
work.

{code:title=hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java}
@@ -2876,6 +2876,7 @@ private Block addStoredBlock(final BlockInfo block,

     if(storedBlock.getBlockUCState() == BlockUCState.COMMITTED &&
         hasMinStorage(storedBlock, numLiveReplicas)) {
+      addExpectedReplicasToPending(storedBlock);
       completeBlock(storedBlock, false);
     } else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) {
       // check whether safe replication is reached for the block
{code}

This way, the unit test will pass because newly completed blocks will be added 
to pending replications either by client's complete file request, or IBR. 
[~iwasakims], what's your opinion?

> 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
>         Attachments: HDFS-9535.000.patch
>
>
> 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