hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brando...@apache.org
Subject svn commit: r1487647 - in /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: ./ src/main/java/org/apache/hadoop/hdfs/ src/main/java/org/apache/hadoop/hdfs/server/namenode/ src/main/java/org/apache/hadoop/hdfs/tools/snapshot/ src/test/java/org/apache...
Date Wed, 29 May 2013 21:25:02 GMT
Author: brandonli
Date: Wed May 29 21:25:01 2013
New Revision: 1487647

URL: http://svn.apache.org/r1487647
Log:
HDFS-4846. Clean up snapshot CLI commands output stacktrace for invalid arguments. Contributed
by Jing Zhao

Modified:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/LsSnapshottableDir.java
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/SnapshotDiff.java
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestNestedSnapshots.java
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDeletion.java

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1487647&r1=1487646&r2=1487647&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed May 29 21:25:01 2013
@@ -607,6 +607,9 @@ Trunk (Unreleased)
     HDFS-4842. Identify the correct prior snapshot when deleting a 
     snapshot under a renamed subtree. (jing9)
 
+    HDFS-4846. Clean up snapshot CLI commands output stacktrace for invalid
+    arguments. (Jing Zhao via brandonli)
+
 Release 2.0.5-beta - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java?rev=1487647&r1=1487646&r2=1487647&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
Wed May 29 21:25:01 2013
@@ -2125,11 +2125,7 @@ public class DFSClient implements java.i
    */
   public void allowSnapshot(String snapshotRoot) throws IOException {
     checkOpen();
-    try {
-      namenode.allowSnapshot(snapshotRoot);
-    } catch(RemoteException re) {
-      throw re.unwrapRemoteException();
-    }
+    namenode.allowSnapshot(snapshotRoot);
   }
   
   /**
@@ -2139,11 +2135,7 @@ public class DFSClient implements java.i
    */
   public void disallowSnapshot(String snapshotRoot) throws IOException {
     checkOpen();
-    try {
-      namenode.disallowSnapshot(snapshotRoot);
-    } catch(RemoteException re) {
-      throw re.unwrapRemoteException();
-    }
+    namenode.disallowSnapshot(snapshotRoot);
   }
   
   /**

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java?rev=1487647&r1=1487646&r2=1487647&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
Wed May 29 21:25:01 2013
@@ -1433,7 +1433,7 @@ public class FSDirectory implements Clos
         INodeDirectorySnapshottable ssTargetDir = 
             (INodeDirectorySnapshottable) targetDir;
         if (ssTargetDir.getNumSnapshots() > 0) {
-          throw new IOException("The direcotry " + ssTargetDir.getFullPathName()
+          throw new IOException("The directory " + ssTargetDir.getFullPathName()
               + " cannot be deleted since " + ssTargetDir.getFullPathName()
               + " is snapshottable and already has snapshots");
         } else {

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/LsSnapshottableDir.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/LsSnapshottableDir.java?rev=1487647&r1=1487646&r2=1487647&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/LsSnapshottableDir.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/LsSnapshottableDir.java
Wed May 29 21:25:01 2013
@@ -51,8 +51,13 @@ public class LsSnapshottableDir {
     }
     DistributedFileSystem dfs = (DistributedFileSystem) fs;
     
-    SnapshottableDirectoryStatus[] stats = dfs.getSnapshottableDirListing();
-    SnapshottableDirectoryStatus.print(stats, System.out);
+    try {
+      SnapshottableDirectoryStatus[] stats = dfs.getSnapshottableDirListing();
+      SnapshottableDirectoryStatus.print(stats, System.out);
+    } catch (IOException e) {
+      String[] content = e.getLocalizedMessage().split("\n");
+      System.err.println("lsSnapshottableDir: " + content[0]);
+    }
   }
 
 }

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/SnapshotDiff.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/SnapshotDiff.java?rev=1487647&r1=1487646&r2=1487647&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/SnapshotDiff.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/snapshot/SnapshotDiff.java
Wed May 29 21:25:01 2013
@@ -82,9 +82,14 @@ public class SnapshotDiff {
     Path snapshotRoot = new Path(argv[0]);
     String fromSnapshot = getSnapshotName(argv[1]);
     String toSnapshot = getSnapshotName(argv[2]);
-    SnapshotDiffReport diffReport = dfs.getSnapshotDiffReport(snapshotRoot,
-        fromSnapshot, toSnapshot);
-    System.out.println(diffReport.toString());
+    try {
+      SnapshotDiffReport diffReport = dfs.getSnapshotDiffReport(snapshotRoot,
+          fromSnapshot, toSnapshot);
+      System.out.println(diffReport.toString());
+    } catch (IOException e) {
+      String[] content = e.getLocalizedMessage().split("\n");
+      System.err.println("snapshotDiff: " + content[0]);
+    }
   }
 
 }

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestNestedSnapshots.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestNestedSnapshots.java?rev=1487647&r1=1487646&r2=1487647&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestNestedSnapshots.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestNestedSnapshots.java
Wed May 29 21:25:01 2013
@@ -135,7 +135,7 @@ public class TestNestedSnapshots {
     try {
       hdfs.disallowSnapshot(rootPath);
       fail("Expect snapshot exception when disallowing snapshot on root again");
-    } catch (SnapshotException e) {
+    } catch (RemoteException e) {
       GenericTestUtils.assertExceptionContains(
           "Root is not a snapshottable directory", e);
     }
@@ -149,14 +149,16 @@ public class TestNestedSnapshots {
     try {
       hdfs.allowSnapshot(rootPath);
       Assert.fail();
-    } catch(SnapshotException se) {
-      assertNestedSnapshotException(se, "subdirectory");
+    } catch(RemoteException se) {
+      assertNestedSnapshotException(
+          (SnapshotException) se.unwrapRemoteException(), "subdirectory");
     }
     try {
       hdfs.allowSnapshot(foo);
       Assert.fail();
-    } catch(SnapshotException se) {
-      assertNestedSnapshotException(se, "subdirectory");
+    } catch(RemoteException se) {
+      assertNestedSnapshotException(
+          (SnapshotException) se.unwrapRemoteException(), "subdirectory");
     }
 
     final Path sub1Bar = new Path(bar, "sub1");
@@ -165,14 +167,16 @@ public class TestNestedSnapshots {
     try {
       hdfs.allowSnapshot(sub1Bar);
       Assert.fail();
-    } catch(SnapshotException se) {
-      assertNestedSnapshotException(se, "ancestor");
+    } catch(RemoteException se) {
+      assertNestedSnapshotException(
+          (SnapshotException) se.unwrapRemoteException(), "ancestor");
     }
     try {
       hdfs.allowSnapshot(sub2Bar);
       Assert.fail();
-    } catch(SnapshotException se) {
-      assertNestedSnapshotException(se, "ancestor");
+    } catch(RemoteException se) {
+      assertNestedSnapshotException(
+          (SnapshotException) se.unwrapRemoteException(), "ancestor");
     }
   }
   

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDeletion.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDeletion.java?rev=1487647&r1=1487646&r2=1487647&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDeletion.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDeletion.java
Wed May 29 21:25:01 2013
@@ -112,7 +112,7 @@ public class TestSnapshotDeletion {
 
     // Deleting a snapshottable dir with snapshots should fail
     exception.expect(RemoteException.class);
-    String error = "The direcotry " + sub.toString()
+    String error = "The directory " + sub.toString()
         + " cannot be deleted since " + sub.toString()
         + " is snapshottable and already has snapshots";
     exception.expectMessage(error);



Mime
View raw message