hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinayakum...@apache.org
Subject [2/2] hadoop git commit: HDFS-8577. Avoid retrying to recover lease on a file which does not exist (Contributed by J.Andreina)
Date Fri, 03 Jul 2015 08:06:42 GMT
HDFS-8577. Avoid retrying to recover lease on a file which does not exist (Contributed by J.Andreina)

(cherry picked from commit 2eae130ab9edd318c82503c2306f610f2b5a3e51)


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

Branch: refs/heads/branch-2
Commit: b963ca84bcbdc4b9f4d88e1e7cdeaccb56175da7
Parents: f2c0539
Author: Vinayakumar B <vinayakumarb@apache.org>
Authored: Fri Jul 3 13:35:48 2015 +0530
Committer: Vinayakumar B <vinayakumarb@apache.org>
Committed: Fri Jul 3 13:36:07 2015 +0530

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt               |  3 +++
 .../java/org/apache/hadoop/hdfs/tools/DebugAdmin.java     | 10 ++++++++--
 .../java/org/apache/hadoop/hdfs/tools/TestDebugAdmin.java |  8 ++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b963ca84/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index da3d8a0..80ab1de 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -666,6 +666,9 @@ Release 2.8.0 - UNRELEASED
     HDFS-8706. Fix typo in datanode startup options in HDFSCommands.html.
     (Brahma Reddy Battula via Arpit Agarwal)
 
+    HDFS-8577. Avoid retrying to recover lease on a file which does not exist
+    (J.Andreina via vinayakumarb)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b963ca84/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java
index 41f1ca4..d179a5c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DebugAdmin.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hdfs.tools;
 
 import java.io.DataInputStream;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -254,6 +255,11 @@ public class DebugAdmin extends Configured implements Tool {
         IOException ioe = null;
         try {
           recovered = dfs.recoverLease(new Path(pathStr));
+        } catch (FileNotFoundException e) {
+          System.err.println("recoverLease got exception: " + e.getMessage());
+          System.err.println("Giving up on recoverLease for " + pathStr +
+              " after 1 try");
+          return 1;
         } catch (IOException e) {
           ioe = e;
         }
@@ -262,8 +268,8 @@ public class DebugAdmin extends Configured implements Tool {
           return 0;
         }
         if (ioe != null) {
-          System.err.println("recoverLease got exception: ");
-          ioe.printStackTrace();
+          System.err.println("recoverLease got exception: " +
+              ioe.getMessage());
         } else {
           System.err.println("recoverLease returned false.");
         }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b963ca84/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDebugAdmin.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDebugAdmin.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDebugAdmin.java
index 52b194d..07f70e0 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDebugAdmin.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDebugAdmin.java
@@ -37,6 +37,7 @@ import java.io.PrintStream;
 
 import static org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetTestUtil.*;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 public class TestDebugAdmin {
   private MiniDFSCluster cluster;
@@ -116,4 +117,11 @@ public class TestDebugAdmin {
             "-block", blockFile.getAbsolutePath()})
     );
   }
+
+  @Test(timeout = 60000)
+  public void testRecoverLeaseforFileNotFound() throws Exception {
+    assertTrue(runCmd(new String[] {
+        "recoverLease", "-path", "/foo", "-retries", "2" }).contains(
+        "Giving up on recoverLease for /foo after 1 try"));
+  }
 }


Mime
View raw message