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 ae...@apache.org on 2016/06/07 17:34:51 UTC

[04/47] hadoop git commit: HDFS-9476. TestDFSUpgradeFromImage#testUpgradeFromRel1BBWImage occasionally fail. Contributed by Masatake Iwasaki.

HDFS-9476. TestDFSUpgradeFromImage#testUpgradeFromRel1BBWImage occasionally fail. Contributed by Masatake Iwasaki.


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

Branch: refs/heads/HDFS-1312
Commit: 69555fca066815053dd9168ebe15868a5c02cdcd
Parents: 16b1cc7
Author: Akira Ajisaka <aa...@apache.org>
Authored: Thu Jun 2 18:52:47 2016 +0900
Committer: Akira Ajisaka <aa...@apache.org>
Committed: Thu Jun 2 18:52:47 2016 +0900

----------------------------------------------------------------------
 .../apache/hadoop/hdfs/TestDFSUpgradeFromImage.java | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/69555fca/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
index 1ba36f3..60bea7a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
@@ -173,7 +173,7 @@ public class TestDFSUpgradeFromImage {
   private static FSInputStream dfsOpenFileWithRetries(DistributedFileSystem dfs,
       String pathName) throws IOException {
     IOException exc = null;
-    for (int tries = 0; tries < 10; tries++) {
+    for (int tries = 0; tries < 30; tries++) {
       try {
         return dfs.dfs.open(pathName);
       } catch (IOException e) {
@@ -184,6 +184,7 @@ public class TestDFSUpgradeFromImage {
         throw exc;
       }
       try {
+        LOG.info("Open failed. " + tries + " times. Retrying.");
         Thread.sleep(1000);
       } catch (InterruptedException ignored) {}
     }
@@ -570,8 +571,17 @@ public class TestDFSUpgradeFromImage {
     String pathStr = path.toString();
     HdfsFileStatus status = dfs.getFileInfo(pathStr);
     if (!status.isDir()) {
-      dfs.recoverLease(pathStr);
-      return;
+      for (int retries = 10; retries > 0; retries--) {
+        if (dfs.recoverLease(pathStr)) {
+          return;
+        } else {
+          try {
+            Thread.sleep(1000);
+          } catch (InterruptedException ignored) {
+          }
+        }
+      }
+      throw new IOException("Failed to recover lease of " + path);
     }
     byte prev[] = HdfsFileStatus.EMPTY_NAME;
     DirectoryListing dirList;


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