hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject hadoop git commit: HADOOP-14211. FilterFs and ChRootedFs are too aggressive about enforcing 'authorityNeeded'. Contributed by Erik Krogen.
Date Fri, 24 Mar 2017 18:12:40 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 14414705f -> 96fe940e5


HADOOP-14211. FilterFs and ChRootedFs are too aggressive about enforcing 'authorityNeeded'.
Contributed by Erik Krogen.

(cherry picked from commit 0e556a5ba645570d381beca60114a1239b27d49f)


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

Branch: refs/heads/branch-2
Commit: 96fe940e59127dc7c3e4182c3ed450c3cd8d858e
Parents: 1441470
Author: Andrew Wang <wang@apache.org>
Authored: Fri Mar 24 11:12:02 2017 -0700
Committer: Andrew Wang <wang@apache.org>
Committed: Fri Mar 24 11:12:31 2017 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/fs/FilterFs.java    |  3 +--
 .../java/org/apache/hadoop/fs/viewfs/ChRootedFs.java    |  3 +--
 .../test/java/org/apache/hadoop/fs/TestFilterFs.java    | 12 ++++++++++++
 3 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/96fe940e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFs.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFs.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFs.java
index 6b1093e..5c16a4e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFs.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFs.java
@@ -57,8 +57,7 @@ public abstract class FilterFs extends AbstractFileSystem {
   }
   
   protected FilterFs(AbstractFileSystem fs) throws URISyntaxException {
-    super(fs.getUri(), fs.getUri().getScheme(),
-        fs.getUri().getAuthority() != null, fs.getUriDefaultPort());
+    super(fs.getUri(), fs.getUri().getScheme(), false, fs.getUriDefaultPort());
     myFs = fs;
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/96fe940e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
index d77ad8b..ad1f5b5 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ChRootedFs.java
@@ -101,8 +101,7 @@ class ChRootedFs extends AbstractFileSystem {
 
   public ChRootedFs(final AbstractFileSystem fs, final Path theRoot)
     throws URISyntaxException {
-    super(fs.getUri(), fs.getUri().getScheme(),
-        fs.getUri().getAuthority() != null, fs.getUriDefaultPort());
+    super(fs.getUri(), fs.getUri().getScheme(), false, fs.getUriDefaultPort());
     myFs = fs;
     myFs.checkPath(theRoot);
     chRootPathPart = new Path(myFs.getUriPath(theRoot));

http://git-wip-us.apache.org/repos/asf/hadoop/blob/96fe940e/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFs.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFs.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFs.java
index 27d093c..a2f0905 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFs.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFs.java
@@ -25,6 +25,8 @@ import java.util.Iterator;
 
 import junit.framework.TestCase;
 import org.apache.commons.logging.Log;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.viewfs.ConfigUtil;
 
 public class TestFilterFs extends TestCase {
 
@@ -65,4 +67,14 @@ public class TestFilterFs extends TestCase {
     }
   }
   
+  // Test that FilterFs will accept an AbstractFileSystem to be filtered which
+  // has an optional authority, such as ViewFs
+  public void testFilteringWithNonrequiredAuthority() throws Exception {
+    Configuration conf = new Configuration();
+    ConfigUtil.addLink(conf, "custom", "/mnt", URI.create("file:///"));
+    FileContext fc =
+        FileContext.getFileContext(URI.create("viewfs://custom/"), conf);
+    new FilterFs(fc.getDefaultFileSystem()) {};
+  }
+
 }


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


Mime
View raw message