[hadoop] branch trunk updated: HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). Contributed by Daryn Sharp and Ahmed Hussein

2020-11-19 Thread jbrennan
This is an automated email from the ASF dual-hosted git repository.

jbrennan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 0705033  HADOOP-17367. Add InetAddress api to ProxyUsers.authorize 
(#2449). Contributed by Daryn Sharp and Ahmed Hussein
0705033 is described below

commit 07050339e0a41a7d4b89b852ffdd7aa315a9184b
Author: Ahmed Hussein <50450311+amahuss...@users.noreply.github.com>
AuthorDate: Thu Nov 19 15:37:14 2020 -0500

HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). 
Contributed by Daryn Sharp and Ahmed Hussein
---
 hadoop-common-project/hadoop-common/pom.xml|   1 -
 .../authorize/DefaultImpersonationProvider.java|   5 +-
 .../security/authorize/ImpersonationProvider.java  |  26 -
 .../hadoop/security/authorize/ProxyUsers.java  |  37 --
 .../java/org/apache/hadoop/util/MachineList.java   | 128 +
 .../hadoop/security/authorize/TestProxyUsers.java  |  29 -
 .../org/apache/hadoop/util/TestMachineList.java| 117 ++-
 .../dynamometer/AllowAllImpersonationProvider.java |   4 +-
 .../workloadgenerator/TestWorkloadGenerator.java   |   3 +-
 9 files changed, 203 insertions(+), 147 deletions(-)

diff --git a/hadoop-common-project/hadoop-common/pom.xml 
b/hadoop-common-project/hadoop-common/pom.xml
index f692c8d..f3a838e 100644
--- a/hadoop-common-project/hadoop-common/pom.xml
+++ b/hadoop-common-project/hadoop-common/pom.xml
@@ -37,7 +37,6 @@
 wsce-site.xml
   
 
-
   
 
   org.apache.hadoop.thirdparty
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
index 9bb7bcc..f258930 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -105,8 +106,8 @@ public class DefaultImpersonationProvider implements 
ImpersonationProvider {
   }
 
   @Override
-  public void authorize(UserGroupInformation user, 
-  String remoteAddress) throws AuthorizationException {
+  public void authorize(UserGroupInformation user,
+  InetAddress remoteAddress) throws AuthorizationException {
 
 if (user == null) {
   throw new IllegalArgumentException("user is null.");
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
index 8b483f0..eff77d8 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
@@ -18,6 +18,9 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configurable;
@@ -38,12 +41,29 @@ public interface ImpersonationProvider  extends 
Configurable {
   public void init(String configurationPrefix);
 
   /**
-   * Authorize the superuser which is doing doAs
-   * 
+   * Authorize the superuser which is doing doAs.
+   * {@link #authorize(UserGroupInformation, InetAddress)} should
+   * be preferred to avoid possibly re-resolving the ip address.
+   * @param user ugi of the effective or proxy user which contains a real user.
+   * @param remoteAddress the ip address of client.
+   * @throws AuthorizationException
+   */
+  default void authorize(UserGroupInformation user, String remoteAddress)
+  throws AuthorizationException {
+try {
+  authorize(user, InetAddress.getByName(remoteAddress));
+} catch (UnknownHostException e) {
+  throw new AuthorizationException(e);
+}
+  }
+
+  /**
+   * Authorize the superuser which is doing doAs.
+   *
* @param user ugi of the effective or proxy user which contains a real user
* @param remoteAddress the ip address of client
* @throws AuthorizationException
*/
-  public void authorize(UserGroupInformation user, String remoteAddress)
+  void authorize(UserGroupInformation user, InetAddress remoteAddress)
   throws AuthorizationException;
 }
\ No newline at end of file
diff --git 
a/hadoop-common-project/had

[hadoop] branch branch-3.3 updated: HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). Contributed by Daryn Sharp and Ahmed Hussein

2020-11-19 Thread jbrennan
This is an automated email from the ASF dual-hosted git repository.

jbrennan pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.3 by this push:
 new e24a6b5  HADOOP-17367. Add InetAddress api to ProxyUsers.authorize 
(#2449). Contributed by Daryn Sharp and Ahmed Hussein
e24a6b5 is described below

commit e24a6b550ea5354dd3afcab294b9e33af32e631c
Author: Jim Brennan 
AuthorDate: Thu Nov 19 21:26:47 2020 +

HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). 
Contributed by Daryn Sharp and Ahmed Hussein
---
 hadoop-common-project/hadoop-common/pom.xml|   1 -
 .../authorize/DefaultImpersonationProvider.java|   5 +-
 .../security/authorize/ImpersonationProvider.java  |  26 -
 .../hadoop/security/authorize/ProxyUsers.java  |  37 --
 .../java/org/apache/hadoop/util/MachineList.java   | 128 +
 .../hadoop/security/authorize/TestProxyUsers.java  |  29 -
 .../org/apache/hadoop/util/TestMachineList.java| 117 ++-
 .../dynamometer/AllowAllImpersonationProvider.java |   4 +-
 .../workloadgenerator/TestWorkloadGenerator.java   |   3 +-
 9 files changed, 203 insertions(+), 147 deletions(-)

diff --git a/hadoop-common-project/hadoop-common/pom.xml 
b/hadoop-common-project/hadoop-common/pom.xml
index 6cab2db..8daf557 100644
--- a/hadoop-common-project/hadoop-common/pom.xml
+++ b/hadoop-common-project/hadoop-common/pom.xml
@@ -37,7 +37,6 @@
 wsce-site.xml
   
 
-
   
 
   org.apache.hadoop.thirdparty
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
index b766d5c..f645359 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -105,8 +106,8 @@ public class DefaultImpersonationProvider implements 
ImpersonationProvider {
   }
 
   @Override
-  public void authorize(UserGroupInformation user, 
-  String remoteAddress) throws AuthorizationException {
+  public void authorize(UserGroupInformation user,
+  InetAddress remoteAddress) throws AuthorizationException {
 
 if (user == null) {
   throw new IllegalArgumentException("user is null.");
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
index 8b483f0..eff77d8 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
@@ -18,6 +18,9 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configurable;
@@ -38,12 +41,29 @@ public interface ImpersonationProvider  extends 
Configurable {
   public void init(String configurationPrefix);
 
   /**
-   * Authorize the superuser which is doing doAs
-   * 
+   * Authorize the superuser which is doing doAs.
+   * {@link #authorize(UserGroupInformation, InetAddress)} should
+   * be preferred to avoid possibly re-resolving the ip address.
+   * @param user ugi of the effective or proxy user which contains a real user.
+   * @param remoteAddress the ip address of client.
+   * @throws AuthorizationException
+   */
+  default void authorize(UserGroupInformation user, String remoteAddress)
+  throws AuthorizationException {
+try {
+  authorize(user, InetAddress.getByName(remoteAddress));
+} catch (UnknownHostException e) {
+  throw new AuthorizationException(e);
+}
+  }
+
+  /**
+   * Authorize the superuser which is doing doAs.
+   *
* @param user ugi of the effective or proxy user which contains a real user
* @param remoteAddress the ip address of client
* @throws AuthorizationException
*/
-  public void authorize(UserGroupInformation user, String remoteAddress)
+  void authorize(UserGroupInformation user, InetAddress remoteAddress)
   throws AuthorizationException;
 }
\ No newline at end of file
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/ha

[hadoop] branch branch-3.2 updated: HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). Contributed by Daryn Sharp and Ahmed Hussein

2020-11-19 Thread jbrennan
This is an automated email from the ASF dual-hosted git repository.

jbrennan pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
 new 6b3d65b  HADOOP-17367. Add InetAddress api to ProxyUsers.authorize 
(#2449). Contributed by Daryn Sharp and Ahmed Hussein
6b3d65b is described below

commit 6b3d65b46ed6535c7754501287186c7128b32ed4
Author: Jim Brennan 
AuthorDate: Thu Nov 19 21:55:28 2020 +

HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). 
Contributed by Daryn Sharp and Ahmed Hussein
---
 hadoop-common-project/hadoop-common/pom.xml|   1 -
 .../authorize/DefaultImpersonationProvider.java|   5 +-
 .../security/authorize/ImpersonationProvider.java  |  26 -
 .../hadoop/security/authorize/ProxyUsers.java  |  37 --
 .../java/org/apache/hadoop/util/MachineList.java   | 128 +
 .../hadoop/security/authorize/TestProxyUsers.java  |  29 -
 .../org/apache/hadoop/util/TestMachineList.java| 117 ++-
 7 files changed, 198 insertions(+), 145 deletions(-)

diff --git a/hadoop-common-project/hadoop-common/pom.xml 
b/hadoop-common-project/hadoop-common/pom.xml
index 4fda535..f486136 100644
--- a/hadoop-common-project/hadoop-common/pom.xml
+++ b/hadoop-common-project/hadoop-common/pom.xml
@@ -38,7 +38,6 @@
 wsce-site.xml
   
 
-
   
 
   org.apache.hadoop
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
index b766d5c..f645359 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -105,8 +106,8 @@ public class DefaultImpersonationProvider implements 
ImpersonationProvider {
   }
 
   @Override
-  public void authorize(UserGroupInformation user, 
-  String remoteAddress) throws AuthorizationException {
+  public void authorize(UserGroupInformation user,
+  InetAddress remoteAddress) throws AuthorizationException {
 
 if (user == null) {
   throw new IllegalArgumentException("user is null.");
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
index 8b483f0..eff77d8 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
@@ -18,6 +18,9 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configurable;
@@ -38,12 +41,29 @@ public interface ImpersonationProvider  extends 
Configurable {
   public void init(String configurationPrefix);
 
   /**
-   * Authorize the superuser which is doing doAs
-   * 
+   * Authorize the superuser which is doing doAs.
+   * {@link #authorize(UserGroupInformation, InetAddress)} should
+   * be preferred to avoid possibly re-resolving the ip address.
+   * @param user ugi of the effective or proxy user which contains a real user.
+   * @param remoteAddress the ip address of client.
+   * @throws AuthorizationException
+   */
+  default void authorize(UserGroupInformation user, String remoteAddress)
+  throws AuthorizationException {
+try {
+  authorize(user, InetAddress.getByName(remoteAddress));
+} catch (UnknownHostException e) {
+  throw new AuthorizationException(e);
+}
+  }
+
+  /**
+   * Authorize the superuser which is doing doAs.
+   *
* @param user ugi of the effective or proxy user which contains a real user
* @param remoteAddress the ip address of client
* @throws AuthorizationException
*/
-  public void authorize(UserGroupInformation user, String remoteAddress)
+  void authorize(UserGroupInformation user, InetAddress remoteAddress)
   throws AuthorizationException;
 }
\ No newline at end of file
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ProxyUsers.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/Pr

[hadoop] branch branch-3.1 updated: HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). Contributed by Daryn Sharp and Ahmed Hussein

2020-11-19 Thread jbrennan
This is an automated email from the ASF dual-hosted git repository.

jbrennan pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
 new da87653  HADOOP-17367. Add InetAddress api to ProxyUsers.authorize 
(#2449). Contributed by Daryn Sharp and Ahmed Hussein
da87653 is described below

commit da87653b661e6ba853c4e0c055e35b161505aae5
Author: Jim Brennan 
AuthorDate: Thu Nov 19 21:55:28 2020 +

HADOOP-17367. Add InetAddress api to ProxyUsers.authorize (#2449). 
Contributed by Daryn Sharp and Ahmed Hussein

(cherry picked from commit 6b3d65b46ed6535c7754501287186c7128b32ed4)
---
 hadoop-common-project/hadoop-common/pom.xml|   1 -
 .../authorize/DefaultImpersonationProvider.java|   5 +-
 .../security/authorize/ImpersonationProvider.java  |  26 -
 .../hadoop/security/authorize/ProxyUsers.java  |  37 --
 .../java/org/apache/hadoop/util/MachineList.java   | 128 +
 .../hadoop/security/authorize/TestProxyUsers.java  |  29 -
 .../org/apache/hadoop/util/TestMachineList.java| 117 ++-
 7 files changed, 198 insertions(+), 145 deletions(-)

diff --git a/hadoop-common-project/hadoop-common/pom.xml 
b/hadoop-common-project/hadoop-common/pom.xml
index 74ddb09..8ffdb6c 100644
--- a/hadoop-common-project/hadoop-common/pom.xml
+++ b/hadoop-common-project/hadoop-common/pom.xml
@@ -38,7 +38,6 @@
 wsce-site.xml
   
 
-
   
 
   org.apache.hadoop
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
index 26cd7ab..9b6c4f6 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/DefaultImpersonationProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -105,8 +106,8 @@ public class DefaultImpersonationProvider implements 
ImpersonationProvider {
   }
 
   @Override
-  public void authorize(UserGroupInformation user, 
-  String remoteAddress) throws AuthorizationException {
+  public void authorize(UserGroupInformation user,
+  InetAddress remoteAddress) throws AuthorizationException {
 
 if (user == null) {
   throw new IllegalArgumentException("user is null.");
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
index 8b483f0..eff77d8 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ImpersonationProvider.java
@@ -18,6 +18,9 @@
 
 package org.apache.hadoop.security.authorize;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configurable;
@@ -38,12 +41,29 @@ public interface ImpersonationProvider  extends 
Configurable {
   public void init(String configurationPrefix);
 
   /**
-   * Authorize the superuser which is doing doAs
-   * 
+   * Authorize the superuser which is doing doAs.
+   * {@link #authorize(UserGroupInformation, InetAddress)} should
+   * be preferred to avoid possibly re-resolving the ip address.
+   * @param user ugi of the effective or proxy user which contains a real user.
+   * @param remoteAddress the ip address of client.
+   * @throws AuthorizationException
+   */
+  default void authorize(UserGroupInformation user, String remoteAddress)
+  throws AuthorizationException {
+try {
+  authorize(user, InetAddress.getByName(remoteAddress));
+} catch (UnknownHostException e) {
+  throw new AuthorizationException(e);
+}
+  }
+
+  /**
+   * Authorize the superuser which is doing doAs.
+   *
* @param user ugi of the effective or proxy user which contains a real user
* @param remoteAddress the ip address of client
* @throws AuthorizationException
*/
-  public void authorize(UserGroupInformation user, String remoteAddress)
+  void authorize(UserGroupInformation user, InetAddress remoteAddress)
   throws AuthorizationException;
 }
\ No newline at end of file
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/authorize/ProxyUsers.java
 
b/hadoop-comm

[hadoop] branch trunk updated: HDFS-15635. ViewFileSystemOverloadScheme support specifying mount table loader imp through conf (#2389). Contributed by Junfan Zhang.

2020-11-19 Thread umamahesh
This is an automated email from the ASF dual-hosted git repository.

umamahesh pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 8fa699b  HDFS-15635. ViewFileSystemOverloadScheme support specifying 
mount table loader imp through conf (#2389). Contributed by Junfan Zhang.
8fa699b is described below

commit 8fa699b53fea8728e008c46af949f92543c08170
Author: zhang_jf 
AuthorDate: Fri Nov 20 12:21:16 2020 +0800

HDFS-15635. ViewFileSystemOverloadScheme support specifying mount table 
loader imp through conf (#2389). Contributed by Junfan Zhang.
---
 .../org/apache/hadoop/fs/viewfs/Constants.java |  7 +
 .../fs/viewfs/ViewFileSystemOverloadScheme.java| 33 --
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/Constants.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/Constants.java
index 5c27692..8235e93 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/Constants.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/Constants.java
@@ -125,4 +125,11 @@ public interface Constants {
   "fs.viewfs.ignore.port.in.mount.table.name";
 
   boolean CONFIG_VIEWFS_IGNORE_PORT_IN_MOUNT_TABLE_NAME_DEFAULT = false;
+
+  String CONFIG_VIEWFS_MOUNTTABLE_LOADER_IMPL =
+  CONFIG_VIEWFS_PREFIX + ".config.loader.impl";
+
+  Class
+  DEFAULT_MOUNT_TABLE_CONFIG_LOADER_IMPL =
+  HCFSMountTableConfigLoader.class;
 }
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystemOverloadScheme.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystemOverloadScheme.java
index 12877cc..773793b 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystemOverloadScheme.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystemOverloadScheme.java
@@ -17,6 +17,10 @@
  */
 package org.apache.hadoop.fs.viewfs;
 
+import static 
org.apache.hadoop.fs.viewfs.Constants.CONFIG_VIEWFS_IGNORE_PORT_IN_MOUNT_TABLE_NAME;
+import static 
org.apache.hadoop.fs.viewfs.Constants.CONFIG_VIEWFS_MOUNTTABLE_LOADER_IMPL;
+import static 
org.apache.hadoop.fs.viewfs.Constants.DEFAULT_MOUNT_TABLE_CONFIG_LOADER_IMPL;
+
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
@@ -30,8 +34,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FsConstants;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.UnsupportedFileSystemException;
-
-import static 
org.apache.hadoop.fs.viewfs.Constants.CONFIG_VIEWFS_IGNORE_PORT_IN_MOUNT_TABLE_NAME;
+import org.apache.hadoop.util.ReflectionUtils;
 
 /**
  *  This class is extended from the ViewFileSystem for the overloaded
@@ -160,7 +163,7 @@ public class ViewFileSystemOverloadScheme extends 
ViewFileSystem {
 
conf.getBoolean(Constants.CONFIG_VIEWFS_IGNORE_PORT_IN_MOUNT_TABLE_NAME,
 true));
 if (null != mountTableConfigPath) {
-  MountTableConfigLoader loader = new HCFSMountTableConfigLoader();
+  MountTableConfigLoader loader = getMountTableConfigLoader(conf);
   loader.load(mountTableConfigPath, conf);
 } else {
   // TODO: Should we fail here.?
@@ -173,6 +176,30 @@ public class ViewFileSystemOverloadScheme extends 
ViewFileSystem {
 super.initialize(theUri, conf);
   }
 
+  private MountTableConfigLoader getMountTableConfigLoader(
+  final Configuration conf) {
+Class clazz =
+conf.getClass(CONFIG_VIEWFS_MOUNTTABLE_LOADER_IMPL,
+DEFAULT_MOUNT_TABLE_CONFIG_LOADER_IMPL,
+MountTableConfigLoader.class);
+
+if (clazz == null) {
+  throw new RuntimeException(
+  String.format("Errors on getting mount table loader class. "
+  + "The fs.viewfs.mounttable.config.loader.impl conf is %s. ",
+  conf.get(CONFIG_VIEWFS_MOUNTTABLE_LOADER_IMPL,
+  DEFAULT_MOUNT_TABLE_CONFIG_LOADER_IMPL.getName(;
+}
+
+try {
+  MountTableConfigLoader mountTableConfigLoader =
+  ReflectionUtils.newInstance(clazz, conf);
+  return mountTableConfigLoader;
+} catch (Exception e) {
+  throw new RuntimeException(e);
+}
+  }
+
   /**
* This method is overridden because in ViewFileSystemOverloadScheme if
* overloaded scheme matches with mounted target fs scheme, file system


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