hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xg...@apache.org
Subject [18/50] [abbrv] hadoop git commit: HDFS-11178. TestAddStripedBlockInFBR#testAddBlockInFullBlockReport fails frequently in trunk. Contributed By Yiqun Lin.
Date Fri, 09 Dec 2016 22:25:55 GMT
HDFS-11178. TestAddStripedBlockInFBR#testAddBlockInFullBlockReport fails frequently in trunk.
Contributed By Yiqun Lin.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ed898567
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ed898567
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ed898567

Branch: refs/heads/YARN-5734
Commit: ed89856755fd20e814d3ba58e2c183a85a9389d3
Parents: 4dd4f3a
Author: Brahma Reddy Battula <brahma@apache.org>
Authored: Tue Dec 6 22:30:43 2016 +0530
Committer: Brahma Reddy Battula <brahma@apache.org>
Committed: Tue Dec 6 22:30:43 2016 +0530

----------------------------------------------------------------------
 .../namenode/TestAddStripedBlockInFBR.java      | 34 ++++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed898567/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlockInFBR.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlockInFBR.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlockInFBR.java
index ab24a25..6e02372 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlockInFBR.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlockInFBR.java
@@ -30,9 +30,8 @@ import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStriped;
 import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
 import org.apache.hadoop.hdfs.server.blockmanagement.NumberReplicas;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
-import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
+import org.apache.hadoop.test.GenericTestUtils;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -40,6 +39,8 @@ import org.junit.rules.Timeout;
 import org.mockito.Mockito;
 import org.mockito.internal.util.reflection.Whitebox;
 
+import com.google.common.base.Supplier;
+
 import java.io.IOException;
 
 public class TestAddStripedBlockInFBR {
@@ -98,14 +99,27 @@ public class TestAddStripedBlockInFBR {
     DFSTestUtil.createFile(dfs, ecFile,
         cellSize * dataBlocks, (short) 1, 0L);
 
-    // trigger dn's FBR. The FBR will add block-dn mapping.
-    DataNodeTestUtils.triggerBlockReport(dn);
+    GenericTestUtils.waitFor(new Supplier<Boolean>() {
+
+      @Override
+      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
+        }
 
-    // make sure NN has correct block-dn mapping
-    BlockInfoStriped blockInfo = (BlockInfoStriped) cluster.getNamesystem()
-        .getFSDirectory().getINode(ecFile.toString()).asFile().getLastBlock();
-    NumberReplicas nr = spy.countNodes(blockInfo);
-    Assert.assertEquals(groupSize, nr.liveReplicas());
-    Assert.assertEquals(0, nr.excessReplicas());
+        return false;
+      }
+    }, 3000, 60000);
   }
 }


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


Mime
View raw message