Revert "YARN-10053. Use Shared Group Mapping Service in Placement Rules."

This reverts commit 217b56ffdd.
This commit is contained in:
Prabhu Joseph 2020-01-02 14:11:34 +05:30 committed by Prabhu Joseph
parent 217b56ffdd
commit 21ada4d1b0
6 changed files with 4 additions and 16 deletions

View File

@ -50,8 +50,7 @@ public class PrimaryGroupPlacementRule extends FSPlacementRule {
@Override @Override
public boolean initialize(ResourceScheduler scheduler) throws IOException { public boolean initialize(ResourceScheduler scheduler) throws IOException {
super.initialize(scheduler); super.initialize(scheduler);
groupProvider = Groups. groupProvider = new Groups(((FairScheduler)scheduler).getConfig());
getUserToGroupsMappingService(((FairScheduler)scheduler).getConfig());
return true; return true;
} }

View File

@ -53,8 +53,7 @@ public class SecondaryGroupExistingPlacementRule extends FSPlacementRule {
@Override @Override
public boolean initialize(ResourceScheduler scheduler) throws IOException { public boolean initialize(ResourceScheduler scheduler) throws IOException {
super.initialize(scheduler); super.initialize(scheduler);
groupProvider = Groups. groupProvider = new Groups(((FairScheduler)scheduler).getConfig());
getUserToGroupsMappingService(((FairScheduler)scheduler).getConfig());
return true; return true;
} }

View File

@ -366,9 +366,9 @@ public boolean initialize(ResourceScheduler scheduler)
// initialize groups if mappings are present // initialize groups if mappings are present
if (newMappings.size() > 0) { if (newMappings.size() > 0) {
Groups groups = new Groups(conf);
this.mappings = newMappings; this.mappings = newMappings;
this.groups = Groups.getUserToGroupsMappingService( this.groups = groups;
((CapacityScheduler)scheduler).getConf());
this.overrideWithQueueMappings = overrideWithQueueMappings; this.overrideWithQueueMappings = overrideWithQueueMappings;
return true; return true;
} }

View File

@ -61,7 +61,6 @@
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.net.NetworkTopology; import org.apache.hadoop.net.NetworkTopology;
import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.Groups;
import org.apache.hadoop.security.ShellBasedUnixGroupsMapping; import org.apache.hadoop.security.ShellBasedUnixGroupsMapping;
import org.apache.hadoop.security.TestGroupsCaching; import org.apache.hadoop.security.TestGroupsCaching;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
@ -5330,8 +5329,6 @@ public void testQueueMappingWithCurrentUserQueueMappingForaGroup() throws
TestGroupsCaching.FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class); TestGroupsCaching.FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
config.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, config.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES,
"a1" +"=" + "agroup" + ""); "a1" +"=" + "agroup" + "");
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(config);
config.set(CapacitySchedulerConfiguration.QUEUE_MAPPING, config.set(CapacitySchedulerConfiguration.QUEUE_MAPPING,
"g:agroup:%user"); "g:agroup:%user");

View File

@ -20,7 +20,6 @@
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.hadoop.security.Groups;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
@ -306,7 +305,6 @@ public static CapacitySchedulerConfiguration setupQueueMappings(
TestGroupsCaching.FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class); TestGroupsCaching.FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES,
TEST_GROUPUSER +"=" + TEST_GROUP + ";invalid_user=invalid_group"); TEST_GROUPUSER +"=" + TEST_GROUP + ";invalid_user=invalid_group");
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(conf);
UserGroupMappingPlacementRule.QueueMapping userQueueMapping = UserGroupMappingPlacementRule.QueueMapping userQueueMapping =
new UserGroupMappingPlacementRule.QueueMapping( new UserGroupMappingPlacementRule.QueueMapping(

View File

@ -29,7 +29,6 @@
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.security.GroupMappingServiceProvider; import org.apache.hadoop.security.GroupMappingServiceProvider;
import org.apache.hadoop.security.Groups;
import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
@ -561,10 +560,8 @@ public void testGroupContainsPeriod() throws Exception {
sb.append(" </rule>"); sb.append(" </rule>");
sb.append("</queuePlacementPolicy>"); sb.append("</queuePlacementPolicy>");
// change the group resolution
CONF.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, CONF.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
PeriodGroupsMapping.class, GroupMappingServiceProvider.class); PeriodGroupsMapping.class, GroupMappingServiceProvider.class);
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(CONF);
// User queue would be created under primary group queue, and the period // User queue would be created under primary group queue, and the period
// in the group name should be converted into _dot_ // in the group name should be converted into _dot_
createPolicy(sb.toString()); createPolicy(sb.toString());
@ -572,10 +569,8 @@ public void testGroupContainsPeriod() throws Exception {
context = placementManager.placeApplication(asc, "user1"); context = placementManager.placeApplication(asc, "user1");
assertEquals("root.user1_dot_group.user1", context.getQueue()); assertEquals("root.user1_dot_group.user1", context.getQueue());
// undo the group resolution change
CONF.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, CONF.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
SimpleGroupsMapping.class, GroupMappingServiceProvider.class); SimpleGroupsMapping.class, GroupMappingServiceProvider.class);
Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(CONF);
} }
@Test @Test