YARN-8062. yarn rmadmin -getGroups returns group from which the user has been removed. (Sunil G via wangda)

Change-Id: I80ed63846502bf7751b890b6c6c6a7c0679e2b4a
This commit is contained in:
Wangda Tan 2018-03-26 11:16:06 -07:00
parent 22194f3d21
commit 5d381570f8

View File

@ -260,9 +260,8 @@ protected void serviceInit(Configuration conf) throws Exception {
// load core-site.xml
loadConfigurationXml(YarnConfiguration.CORE_SITE_CONFIGURATION_FILE);
// Do refreshUserToGroupsMappings with loaded core-site.xml
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(this.conf)
.refresh();
// Refresh user to group mappings during init.
refreshUserToGroupMappingsWithConf();
// Do refreshSuperUserGroupsConfiguration with loaded core-site.xml
// Or use RM specific configurations to overwrite the common ones first
@ -347,6 +346,21 @@ protected void serviceInit(Configuration conf) throws Exception {
super.serviceInit(this.conf);
}
private void refreshUserToGroupMappingsWithConf()
throws YarnException, IOException {
Configuration newConf = new Configuration(false);
InputStream confFileInputStream =
configurationProvider
.getConfigurationInputStream(newConf, YarnConfiguration.CORE_SITE_CONFIGURATION_FILE);
if (confFileInputStream != null) {
newConf.addResource(confFileInputStream);
}
// Do refreshUserToGroupsMappings with loaded core-site.xml
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(newConf)
.refresh();
}
private void loadConfigurationXml(String configurationFile)
throws YarnException, IOException {
InputStream configurationInputStream =