hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [29/31] hadoop git commit: HDFS-10434. Fix intermittent test failure of TestDataNodeErasureCodingMetrics. Contributed by Rakesh R
Date Fri, 27 May 2016 04:40:03 GMT
HDFS-10434. Fix intermittent test failure of TestDataNodeErasureCodingMetrics. Contributed
by Rakesh R


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

Branch: refs/heads/HDFS-1312
Commit: f69f5ab3b6964b9124c07c97f13141227d5b87b9
Parents: a6c79f9
Author: Kai Zheng <kai.zheng@intel.com>
Authored: Fri May 27 04:42:53 2016 +0800
Committer: Kai Zheng <kai.zheng@intel.com>
Committed: Fri May 27 04:42:53 2016 +0800

----------------------------------------------------------------------
 .../datanode/TestDataNodeErasureCodingMetrics.java  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/f69f5ab3/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeErasureCodingMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeErasureCodingMetrics.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeErasureCodingMetrics.java
index e401fed..c7e99c2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeErasureCodingMetrics.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeErasureCodingMetrics.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor;
 import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
 import org.apache.hadoop.metrics2.MetricsRecordBuilder;
 import static org.apache.hadoop.test.MetricsAsserts.assertCounter;
+import static org.apache.hadoop.test.MetricsAsserts.getLongCounter;
 import static org.apache.hadoop.test.MetricsAsserts.getMetrics;
 import static org.junit.Assert.assertEquals;
 
@@ -89,6 +90,21 @@ public class TestDataNodeErasureCodingMetrics {
   public void testEcTasks() throws Exception {
     DataNode workerDn = doTest("/testEcTasks");
     MetricsRecordBuilder rb = getMetrics(workerDn.getMetrics().name());
+
+    // EcReconstructionTasks metric value will be updated in the finally block
+    // of striped reconstruction thread. Here, giving a grace period to finish
+    // EC reconstruction metric updates in DN.
+    LOG.info("Waiting to finish EC reconstruction metric updates in DN");
+    int retries = 0;
+    while (retries < 20) {
+      long taskMetricValue = getLongCounter("EcReconstructionTasks", rb);
+      if (taskMetricValue > 0) {
+        break;
+      }
+      Thread.sleep(500);
+      retries++;
+      rb = getMetrics(workerDn.getMetrics().name());
+    }
     assertCounter("EcReconstructionTasks", (long) 1, rb);
     assertCounter("EcFailedReconstructionTasks", (long) 0, rb);
   }


---------------------------------------------------------------------
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