ソースを参照

HDFS-14850. Optimize FileSystemAccessService#getFileSystemConfiguration. Contributed by Lisheng Sun.

Inigo Goiri 5 年 前
コミット
d8313b2274

+ 13 - 8
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/hadoop/FileSystemAccessService.java

@@ -136,6 +136,7 @@ public class FileSystemAccessService extends BaseService implements FileSystemAc
   private Collection<String> nameNodeWhitelist;
 
   Configuration serviceHadoopConf;
+  private Configuration fileSystemConf;
 
   private AtomicInteger unmanagedFileSystems = new AtomicInteger();
 
@@ -188,6 +189,7 @@ public class FileSystemAccessService extends BaseService implements FileSystemAc
     }
     try {
       serviceHadoopConf = loadHadoopConf(hadoopConfDir);
+      fileSystemConf = getNewFileSystemConfiguration();
     } catch (IOException ex) {
       throw new ServiceException(FileSystemAccessException.ERROR.H11, ex.toString(), ex);
     }
@@ -212,6 +214,16 @@ public class FileSystemAccessService extends BaseService implements FileSystemAc
     return hadoopConf;
   }
 
+  private Configuration getNewFileSystemConfiguration() {
+    Configuration conf = new Configuration(true);
+    ConfigurationUtils.copy(serviceHadoopConf, conf);
+    conf.setBoolean(FILE_SYSTEM_SERVICE_CREATED, true);
+
+    // Force-clear server-side umask to make HttpFS match WebHDFS behavior
+    conf.set(FsPermission.UMASK_LABEL, "000");
+    return conf;
+  }
+
   @Override
   public void postInit() throws ServiceException {
     super.postInit();
@@ -397,14 +409,7 @@ public class FileSystemAccessService extends BaseService implements FileSystemAc
 
   @Override
   public Configuration getFileSystemConfiguration() {
-    Configuration conf = new Configuration(true);
-    ConfigurationUtils.copy(serviceHadoopConf, conf);
-    conf.setBoolean(FILE_SYSTEM_SERVICE_CREATED, true);
-
-    // Force-clear server-side umask to make HttpFS match WebHDFS behavior
-    conf.set(FsPermission.UMASK_LABEL, "000");
-
-    return conf;
+    return fileSystemConf;
   }
 
 }