You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2020/01/21 21:29:36 UTC

[hadoop] branch trunk updated: HDFS-15092. TestRedudantBlocks#testProcessOverReplicatedAndRedudantBlock sometimes fails. Contributed by Fei Hui.

This is an automated email from the ASF dual-hosted git repository.

inigoiri pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8cfc367  HDFS-15092. TestRedudantBlocks#testProcessOverReplicatedAndRedudantBlock sometimes fails. Contributed by Fei Hui.
8cfc367 is described below

commit 8cfc3673dcbf1901ca6fad11b5c996e54e32ed6b
Author: Inigo Goiri <in...@apache.org>
AuthorDate: Tue Jan 21 13:29:20 2020 -0800

    HDFS-15092. TestRedudantBlocks#testProcessOverReplicatedAndRedudantBlock sometimes fails. Contributed by Fei Hui.
---
 .../hadoop/hdfs/server/namenode/TestRedudantBlocks.java  | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestRedudantBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestRedudantBlocks.java
index ac25da3..1a1fc16 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestRedudantBlocks.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestRedudantBlocks.java
@@ -35,8 +35,10 @@ import org.apache.hadoop.hdfs.protocol.LocatedBlock;
 import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
 import org.apache.hadoop.hdfs.protocol.LocatedStripedBlock;
 import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies;
+import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStriped;
 import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
 import org.apache.hadoop.hdfs.util.StripedBlockUtil;
+import org.apache.hadoop.test.GenericTestUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -108,18 +110,26 @@ public class TestRedudantBlocks {
     blk.setBlockId(groupId + 2);
     cluster.injectBlocks(i, Arrays.asList(blk), bpid);
 
+    BlockInfoStriped blockInfo =
+        (BlockInfoStriped)cluster.getNamesystem().getBlockManager()
+            .getStoredBlock(new Block(groupId));
     // update blocksMap
     cluster.triggerBlockReports();
     // delete redundant block
     cluster.triggerHeartbeats();
     //wait for IBR
-    Thread.sleep(1100);
+    GenericTestUtils.waitFor(
+        () -> cluster.getNamesystem().getBlockManager()
+            .countNodes(blockInfo).liveReplicas() >= groupSize -1,
+        500, 10000);
 
     // trigger reconstruction
     cluster.triggerHeartbeats();
-
     //wait for IBR
-    Thread.sleep(1100);
+    GenericTestUtils.waitFor(
+        () -> cluster.getNamesystem().getBlockManager()
+            .countNodes(blockInfo).liveReplicas() >= groupSize,
+        500, 10000);
 
     HashSet<Long> blockIdsSet = new HashSet<Long>();
 


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