hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Masatake Iwasaki (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-10426) TestPendingInvalidateBlock failed in trunk
Date Mon, 05 Sep 2016 10:14:20 GMT

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

Masatake Iwasaki commented on HDFS-10426:
-----------------------------------------

Sorry for delayed reply, [~linyiqun].

bq. I think it would be better to avoid adding code for testing only to BlockManager.

How about using Mockito as {{testPendingDeleteUnknownBlocks}} already do? {{GenericTestUtils.DelayAnswer}}
could be used to hold method invocation in BlockManager or InvalidateBlocks.


{noformat}
198	  private void waitForBlocksToDelete() throws Exception {
199	    for (int tries = 0; tries < 10; tries++) {
200	      Thread.sleep(6000);
201	
202	      for (int i = 0; i < REPLICATION; i++) {
203	        DataNodeTestUtils.triggerBlockReport(cluster.getDataNodes().get(i));
204	      }
205	
206	      if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) {
207	        break;
208	      }
209	    }
210	  }
{noformat}

You should use {{MiniDFSCluster#triggerBlockReports}} for kicking block reports of all datanodes
and {{GenericTestUtils#waitFor}} for waiting condition.


> TestPendingInvalidateBlock failed in trunk
> ------------------------------------------
>
>                 Key: HDFS-10426
>                 URL: https://issues.apache.org/jira/browse/HDFS-10426
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: test
>            Reporter: Yiqun Lin
>            Assignee: Yiqun Lin
>         Attachments: HDFS-10426.001.patch, HDFS-10426.002.patch, HDFS-10426.003.patch,
HDFS-10426.004.patch
>
>
> The test {{TestPendingInvalidateBlock}} failed sometimes. The stack info:
> {code}
> org.apache.hadoop.hdfs.server.blockmanagement.TestPendingInvalidateBlock
> testPendingDeletion(org.apache.hadoop.hdfs.server.blockmanagement.TestPendingInvalidateBlock)
 Time elapsed: 7.703 sec  <<< FAILURE!
> java.lang.AssertionError: expected:<2> but was:<1>
> 	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.blockmanagement.TestPendingInvalidateBlock.testPendingDeletion(TestPendingInvalidateBlock.java:92)
> {code}
> It looks that the {{invalidateBlock}} has been removed before we do the check
> {code}
>     // restart NN
>     cluster.restartNameNode(true);
>     dfs.delete(foo, true);
>     Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal());
>     Assert.assertEquals(REPLICATION, cluster.getNamesystem()
>         .getPendingDeletionBlocks());
>     Assert.assertEquals(REPLICATION,
>         dfs.getPendingDeletionBlocksCount());
> {code}
> And I look into the related configurations. I found the property {{dfs.namenode.replication.interval}}
was just set as 1 second in this test. And after the delay time of {{dfs.namenode.startup.delay.block.deletion.sec}}
and the delete operation was slowly, it will cause this case. We can see the stack info before,
the failed test costs 7.7s more than 5+1 second.
> One way can improve this.
> * Increase the time of {{dfs.namenode.replication.interval}}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message