From fa41e3845063a840eb043d1bb99593f7b87a0da2 Mon Sep 17 00:00:00 2001 From: Szilard Nemeth Date: Thu, 25 Jun 2020 17:27:58 +0200 Subject: [PATCH] YARN-10279. Avoid unnecessary QueueMappingEntity creations. Contributed by Marton Hudaky (cherry picked from commit 6a8fd73b273629d0c7c071cf4d090f67d9b96fe4) --- .../placement/QueuePlacementRuleUtils.java | 7 +------ .../placement/UserGroupMappingPlacementRule.java | 14 ++------------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/QueuePlacementRuleUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/QueuePlacementRuleUtils.java index 15c8fd8b70..76e3e275fc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/QueuePlacementRuleUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/QueuePlacementRuleUtils.java @@ -74,12 +74,7 @@ public static QueueMapping validateAndGetAutoCreatedQueueMapping( 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; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/UserGroupMappingPlacementRule.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/UserGroupMappingPlacementRule.java index dfa49bea89..e8cbed9fb8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/UserGroupMappingPlacementRule.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/UserGroupMappingPlacementRule.java @@ -487,24 +487,14 @@ private static QueueMapping validateAndGetAutoCreatedQueueMapping( && (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;