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

Brahma Reddy Battula commented on HDFS-11178:
---------------------------------------------

[~linyiqun] thanks for updating patch and reminding me.

I am thinking little cleaner way like following such that we can avoid {{if 
(groupSize == nr.liveReplicas())}} 
{code}
public Boolean get() {
        try {
          // trigger dn's FBR. The FBR will add block-dn mapping.
          cluster.triggerBlockReports();

          // make sure NN has correct block-dn mapping
          BlockInfoStriped blockInfo = (BlockInfoStriped) cluster
              .getNamesystem().getFSDirectory().getINode(ecFile.toString())
              .asFile().getLastBlock();
          NumberReplicas nr = spy.countNodes(blockInfo);
          return nr.excessReplicas() == 0 && nr.liveReplicas() == groupSize;
        } catch (Exception ignored) {
          // Ignore the exception
          return false;
        }
      }
    }, 3000, 60000);
  }
{code}

we can remove {{import org.junit.Assert;}} after above modification.

> TestAddStripedBlockInFBR#testAddBlockInFullBlockReport fails frequently in 
> trunk
> --------------------------------------------------------------------------------
>
>                 Key: HDFS-11178
>                 URL: https://issues.apache.org/jira/browse/HDFS-11178
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: test
>            Reporter: Yiqun Lin
>            Assignee: Yiqun Lin
>         Attachments: HDFS-11178.001.patch, HDFS-11178.002.patch
>
>
> The test {{TestAddStripedBlockInFBR#testAddBlockInFullBlockReport}} fails 
> easily in trunk. It's easy to reproduce the failure, it fails 2~3 times when 
> I run the test 4~-5 times in my local. Also it failed in the recent 
> Jenkins(https://builds.apache.org/job/PreCommit-HDFS-Build/17667/testReport/),
>  The stack infos:
> {code}
> java.lang.AssertionError: expected:<9> but was:<7>
>       at org.junit.Assert.fail(Assert.java:88)
>       at org.junit.Assert.failNotEquals(Assert.java:743)
>       at org.junit.Assert.assertEquals(Assert.java:118)
>       at org.junit.Assert.assertEquals(Assert.java:555)
>       at org.junit.Assert.assertEquals(Assert.java:542)
>       at 
> org.apache.hadoop.hdfs.server.namenode.TestAddStripedBlockInFBR.testAddBlockInFullBlockReport(TestAddStripedBlockInFBR.java:108)
> {code}
> It's easy to have a fix: Use {{GenericTestUtils.waitFor}} to wait the full 
> blocks being reported. 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to