Przeglądaj źródła

HADOOP-6203. FsShell rm/rmr error message indicates exceeding Trash quota and suggests using -skpTrash, when moving to trash fails. Contributed by Boris Shkolnik.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@812317 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 16 lat temu
rodzic
commit
d09ade4d0b

+ 4 - 0
CHANGES.txt

@@ -81,6 +81,10 @@ Trunk (unreleased changes)
     HADOOP-6230. Moved process tree and memory calculator related classes
     from Common to Map/Reduce. (Vinod Kumar Vavilapalli via yhemanth)
 
+    HADOOP-6203. FsShell rm/rmr error message indicates exceeding Trash quota
+    and suggests using -skpTrash, when moving to trash fails.
+    (Boris Shkolnik via suresh)
+
   NEW FEATURES
 
     HADOOP-4268. Change fsck to use ClientProtocol methods so that the

+ 14 - 4
src/java/org/apache/hadoop/fs/FsShell.java

@@ -1130,10 +1130,20 @@ public class FsShell extends Configured implements Tool {
     }
     
     if(!skipTrash) {
-      Trash trashTmp = new Trash(srcFs, getConf());
-      if (trashTmp.moveToTrash(src)) {
-        System.out.println("Moved to trash: " + src);
-        return;
+      try {
+	      Trash trashTmp = new Trash(srcFs, getConf());
+        if (trashTmp.moveToTrash(src)) {
+          System.out.println("Moved to trash: " + src);
+          return;
+        }
+      } catch (IOException e) {
+        Exception cause = (Exception) e.getCause();
+        String msg = "";
+        if(cause != null) {
+          msg = cause.getLocalizedMessage();
+        }
+        System.err.println("Problem with Trash." + msg +". Consider using -skipTrash option");        
+        throw e;
       }
     }
     

+ 1 - 1
src/java/org/apache/hadoop/fs/Trash.java

@@ -123,7 +123,7 @@ public class Trash extends Configured {
     for (int i = 0; i < 2; i++) {
       try {
         if (!fs.mkdirs(baseTrashPath, PERMISSION)) {      // create current
-          LOG.warn("Can't create trash directory: "+baseTrashPath);
+          LOG.warn("Can't create(mkdir) trash directory: "+baseTrashPath);
           return false;
         }
       } catch (IOException e) {