YARN-10279. Avoid unnecessary QueueMappingEntity creations. Contributed by Marton Hudaky

This commit is contained in:
Szilard Nemeth 2020-06-25 17:27:58 +02:00
parent 4b5b54c73f
commit 6a8fd73b27
2 changed files with 3 additions and 18 deletions

View File

@ -74,12 +74,7 @@ public final class QueuePlacementRuleUtils {
validateQueueMappingUnderParentQueue(queueManager.getQueue(
mapping.getParentQueue()), mapping.getParentQueue(),
mapping.getFullPath());
return QueueMapping.QueueMappingBuilder.create()
.type(mapping.getType())
.source(mapping.getSource())
.parentQueue(mapping.getParentQueue())
.queue(mapping.getQueue())
.build();
return mapping;
}
return null;

View File

@ -485,24 +485,14 @@ public class UserGroupMappingPlacementRule extends PlacementRule {
&& (mapping.getParentQueue().equals(PRIMARY_GROUP_MAPPING)
|| mapping.getParentQueue().equals(SECONDARY_GROUP_MAPPING))) {
// dynamic parent queue
return QueueMappingBuilder.create()
.type(mapping.getType())
.source(mapping.getSource())
.queue(mapping.getQueue())
.parentQueue(mapping.getParentQueue())
.build();
return mapping;
} else if (mapping.hasParentQueue()) {
//if parent queue is specified,
// then it should exist and be an instance of ManagedParentQueue
QueuePlacementRuleUtils.validateQueueMappingUnderParentQueue(
queueManager.getQueue(mapping.getParentQueue()),
mapping.getParentQueue(), mapping.getQueue());
return QueueMappingBuilder.create()
.type(mapping.getType())
.source(mapping.getSource())
.queue(mapping.getQueue())
.parentQueue(mapping.getParentQueue())
.build();
return mapping;
}
return null;