hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: HDFS-10603. Fix flaky tests in org.apache.hadoop.hdfs.server.namenode.snapshot.TestOpenFilesWithSnapshot. Contributed by Yiqun Lin.
Date Tue, 19 Jul 2016 20:52:32 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 ad8180fc6 -> c92601e98


HDFS-10603. Fix flaky tests in org.apache.hadoop.hdfs.server.namenode.snapshot.TestOpenFilesWithSnapshot.
Contributed by Yiqun Lin.

(cherry picked from commit fc570b55b9d1d1d57329eca223f443e2c86f34b7)


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

Branch: refs/heads/branch-2
Commit: c92601e9814a041800e466fabdcc3c44309364c4
Parents: ad8180f
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Tue Jul 19 13:49:24 2016 -0700
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Tue Jul 19 13:52:06 2016 -0700

----------------------------------------------------------------------
 .../snapshot/TestOpenFilesWithSnapshot.java     | 21 +++++++++-----------
 1 file changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c92601e9/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestOpenFilesWithSnapshot.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestOpenFilesWithSnapshot.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestOpenFilesWithSnapshot.java
index 812bcc5..7b7c34a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestOpenFilesWithSnapshot.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestOpenFilesWithSnapshot.java
@@ -69,7 +69,7 @@ public class TestOpenFilesWithSnapshot {
     // delete files separately
     fs.delete(new Path("/test/test/test2"), true);
     fs.delete(new Path("/test/test/test3"), true);
-    cluster.restartNameNode();
+    restartNameNode();
   }
 
   @Test
@@ -79,7 +79,7 @@ public class TestOpenFilesWithSnapshot {
 
     // delete parent directory
     fs.delete(new Path("/test/test"), true);
-    cluster.restartNameNode();
+    restartNameNode();
   }
 
   @Test
@@ -87,11 +87,7 @@ public class TestOpenFilesWithSnapshot {
     Path path = new Path("/test");
     doWriteAndAbort(fs, path);
     fs.delete(new Path("/test/test"), true);
-    NameNode nameNode = cluster.getNameNode();
-    NameNodeAdapter.enterSafeMode(nameNode, false);
-    NameNodeAdapter.saveNamespace(nameNode);
-    NameNodeAdapter.leaveSafeMode(nameNode);
-    cluster.restartNameNode(true);
+    restartNameNode();
     
     // read snapshot file after restart
     String test2snapshotPath = Snapshot.getSnapshotPath(path.toString(),
@@ -108,11 +104,7 @@ public class TestOpenFilesWithSnapshot {
     doWriteAndAbort(fs, path);
     fs.delete(new Path("/test/test/test2"), true);
     fs.delete(new Path("/test/test/test3"), true);
-    NameNode nameNode = cluster.getNameNode();
-    NameNodeAdapter.enterSafeMode(nameNode, false);
-    NameNodeAdapter.saveNamespace(nameNode);
-    NameNodeAdapter.leaveSafeMode(nameNode);
-    cluster.restartNameNode(true);
+    restartNameNode();
     
     // read snapshot file after restart
     String test2snapshotPath = Snapshot.getSnapshotPath(path.toString(),
@@ -203,6 +195,11 @@ public class TestOpenFilesWithSnapshot {
 
     fs.rename(new Path("/test/test"), new Path("/test/test-renamed"));
     fs.delete(new Path("/test/test-renamed"), true);
+    restartNameNode();
+  }
+
+  private void restartNameNode() throws Exception {
+    cluster.triggerBlockReports();
     NameNode nameNode = cluster.getNameNode();
     NameNodeAdapter.enterSafeMode(nameNode, false);
     NameNodeAdapter.saveNamespace(nameNode);


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