YARN-8145. yarn rmadmin -getGroups doesn't return updated groups for user. Contributed by Sunil G.
(cherry picked from commit 241d985467
)
This commit is contained in:
parent
213f733604
commit
fa007d986b
|
@ -34,7 +34,6 @@ import org.apache.hadoop.metrics2.MetricsSystem;
|
|||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
||||
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
||||
import org.apache.hadoop.net.NetUtils;
|
||||
import org.apache.hadoop.security.Groups;
|
||||
import org.apache.hadoop.security.SecurityUtil;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.security.authorize.ProxyUsers;
|
||||
|
@ -254,9 +253,6 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|||
// load core-site.xml
|
||||
loadConfigurationXml(YarnConfiguration.CORE_SITE_CONFIGURATION_FILE);
|
||||
|
||||
// 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
|
||||
// if they exist
|
||||
|
@ -340,21 +336,6 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|||
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 =
|
||||
|
|
|
@ -722,6 +722,7 @@ public class TestRMAdminService {
|
|||
}
|
||||
|
||||
// Make sure RM will use the updated GroupMappingServiceProvider
|
||||
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(conf).refresh();
|
||||
List<String> groupBefore =
|
||||
new ArrayList<String>(Groups.getUserToGroupsMappingService(
|
||||
configuration).getGroups(user));
|
||||
|
@ -1099,6 +1100,7 @@ public class TestRMAdminService {
|
|||
.get("hadoop.proxyuser.test.hosts").contains("test_hosts"));
|
||||
|
||||
// verify UserToGroupsMappings
|
||||
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(conf).refresh();
|
||||
List<String> groupAfter =
|
||||
Groups.getUserToGroupsMappingService(configuration).getGroups(
|
||||
UserGroupInformation.getCurrentUser().getUserName());
|
||||
|
|
Loading…
Reference in New Issue