hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lium...@apache.org
Subject hadoop git commit: HDFS-10915. Fix time measurement bug in TestDatanodeRestart. Contributed by Xiaobing Zhou
Date Wed, 28 Sep 2016 03:46:47 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 34ee18d73 -> 54ca505c4


HDFS-10915. Fix time measurement bug in TestDatanodeRestart. Contributed by Xiaobing Zhou

(cherry picked from commit 6437ba18c5c26bc271a63aff5ea03756f43dd9a3)


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

Branch: refs/heads/branch-2
Commit: 54ca505c41850d253c2d86c8655f57ea08137355
Parents: 34ee18d
Author: Mingliang Liu <liuml07@apache.org>
Authored: Tue Sep 27 20:40:17 2016 -0700
Committer: Mingliang Liu <liuml07@apache.org>
Committed: Tue Sep 27 20:42:47 2016 -0700

----------------------------------------------------------------------
 .../datanode/fsdataset/impl/TestDatanodeRestart.java   | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/54ca505c/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestDatanodeRestart.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestDatanodeRestart.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestDatanodeRestart.java
index 40a3d9d..0afee5f 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestDatanodeRestart.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/TestDatanodeRestart.java
@@ -45,6 +45,7 @@ import org.apache.hadoop.hdfs.server.datanode.ReplicaInfo;
 import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi;
 import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi;
 import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.util.Time;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -172,17 +173,17 @@ public class TestDatanodeRestart {
       cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDNs).build();
       cluster.waitActive();
 
-      start = System.currentTimeMillis();
+      start = Time.monotonicNow();
       FileSystem fileSys = cluster.getFileSystem();
       try {
         DFSTestUtil.createFile(fileSys, file, 10240L, (short)1, 0L);
         // It is a bug if this does not fail.
         throw new IOException("Did not fail!");
       } catch (org.apache.hadoop.ipc.RemoteException e) {
-        long elapsed = System.currentTimeMillis() - start;
+        long elapsed = Time.monotonicNow() - start;
         // timers have at-least semantics, so it should be at least 5 seconds.
         if (elapsed < 5000 || elapsed > 10000) {
-          throw new IOException(elapsed + " seconds passed.", e);
+          throw new IOException(elapsed + " milliseconds passed.", e);
         }
       }
       DataNodeFaultInjector.set(oldDnInjector);
@@ -195,18 +196,18 @@ public class TestDatanodeRestart {
       // back to simulating unregistered node.
       DataNodeFaultInjector.set(dnFaultInjector);
       byte[] buffer = new byte[8];
-      start = System.currentTimeMillis();
+      start = Time.monotonicNow();
       try {
         fileSys.open(file).read(0L, buffer, 0, 1);
         throw new IOException("Did not fail!");
       } catch (IOException e) {
-        long elapsed = System.currentTimeMillis() - start;
+        long elapsed = Time.monotonicNow() - start;
         if (e.getMessage().contains("readBlockLength")) {
           throw new IOException("Failed, but with unexpected exception:", e);
         }
         // timers have at-least semantics, so it should be at least 5 seconds.
         if (elapsed < 5000 || elapsed > 10000) {
-          throw new IOException(elapsed + " seconds passed.", e);
+          throw new IOException(elapsed + " milliseconds passed.", e);
         }
       }
       DataNodeFaultInjector.set(oldDnInjector);


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