HDFS-14850. Optimize FileSystemAccessService#getFileSystemConfiguration. Contributed by Lisheng Sun.
(cherry picked from commit d8313b2274
)
This commit is contained in:
parent
aa5dfb2f8a
commit
bb1015719c
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue