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

This commit is contained in:
Inigo Goiri 2019-09-28 17:20:44 -07:00
parent 2200871607
commit d8313b2274

View File

@ -136,6 +136,7 @@ public FileSystemAccessService() {
private Collection<String> nameNodeWhitelist;
Configuration serviceHadoopConf;
private Configuration fileSystemConf;
private AtomicInteger unmanagedFileSystems = new AtomicInteger();
@ -188,6 +189,7 @@ protected void init() throws ServiceException {
}
try {
serviceHadoopConf = loadHadoopConf(hadoopConfDir);
fileSystemConf = getNewFileSystemConfiguration();
} catch (IOException ex) {
throw new ServiceException(FileSystemAccessException.ERROR.H11, ex.toString(), ex);
}
@ -212,6 +214,16 @@ private Configuration loadHadoopConf(File dir) throws IOException {
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 void releaseFileSystem(FileSystem fs) throws IOException {
@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;
}
}