hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject [48/50] [abbrv] hadoop git commit: HADOOP-12119. hadoop fs -expunge does not work for federated namespace (Contributed by J.Andreina)
Date Mon, 29 Jun 2015 23:31:04 GMT
HADOOP-12119. hadoop fs -expunge does not work for federated namespace (Contributed by J.Andreina)


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

Branch: refs/heads/YARN-2928
Commit: d88e580df1567aa6a81cf3ec116b77ddde20acf3
Parents: 7cea49d
Author: Vinayakumar B <vinayakumarb@apache.org>
Authored: Mon Jun 29 15:58:54 2015 +0530
Committer: Zhijie Shen <zjshen@apache.org>
Committed: Mon Jun 29 10:28:29 2015 -0700

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt    |  3 +++
 .../java/org/apache/hadoop/fs/shell/Delete.java    | 17 ++++++++++++++---
 .../test/java/org/apache/hadoop/fs/TestTrash.java  | 14 ++++++++++++--
 3 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d88e580d/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 219ef25..0a964a3 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -884,6 +884,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12076. Incomplete Cache Mechanism in CredentialProvider API.
     (Larry McCay via cnauroth)
 
+    HADOOP-12119. hadoop fs -expunge does not work for federated namespace
+    (J.Andreina via vinayakumarb)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d88e580d/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java
index f882817..40d9478 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java
@@ -25,6 +25,7 @@ import java.util.List;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.PathIOException;
 import org.apache.hadoop.fs.PathIsDirectoryException;
 import org.apache.hadoop.fs.PathIsNotDirectoryException;
@@ -195,9 +196,19 @@ class Delete {
     @Override
     protected void processArguments(LinkedList<PathData> args)
     throws IOException {
-      Trash trash = new Trash(getConf());
-      trash.expunge();
-      trash.checkpoint();    
+      FileSystem[] childFileSystems =
+          FileSystem.get(getConf()).getChildFileSystems();
+      if (null != childFileSystems) {
+        for (FileSystem fs : childFileSystems) {
+          Trash trash = new Trash(fs, getConf());
+          trash.expunge();
+          trash.checkpoint();
+        }
+      } else {
+        Trash trash = new Trash(getConf());
+        trash.expunge();
+        trash.checkpoint();
+      }
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d88e580d/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java
index a675e30..9a91733 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java
@@ -594,8 +594,18 @@ public class TestTrash extends TestCase {
     TestLFS() {
       this(new Path(TEST_DIR, "user/test"));
     }
-    TestLFS(Path home) {
-      super();
+    TestLFS(final Path home) {
+      super(new RawLocalFileSystem() {
+        @Override
+        protected Path getInitialWorkingDirectory() {
+          return makeQualified(home);
+        }
+
+        @Override
+        public Path getHomeDirectory() {
+          return makeQualified(home);
+        }
+      });
       this.home = home;
     }
     @Override


Mime
View raw message