This is an automated email from the ASF dual-hosted git repository. sunilg pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new 6fb29d0 YARN-10226. NPE in Capacity Scheduler while using %primary_group queue mapping. Contributed by Peter Bacsko. 6fb29d0 is described below commit 6fb29d0f1710cbef021e58846eb5c67a8d0b1f87 Author: Sunil G <sun...@apache.org> AuthorDate: Thu Apr 9 18:51:42 2020 +0530 YARN-10226. NPE in Capacity Scheduler while using %primary_group queue mapping. Contributed by Peter Bacsko. --- .../placement/UserGroupMappingPlacementRule.java | 18 ++++++++++-------- .../placement/TestUserGroupMappingPlacementRule.java | 1 + 2 files changed, 11 insertions(+), 8 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/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 4f97582..391fb34 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 @@ -161,17 +161,19 @@ public class UserGroupMappingPlacementRule extends PlacementRule { String group = CapacitySchedulerConfiguration.ROOT + "." + getPrimaryGroup(user); - CSQueue parent = queueManager.getQueue(mapping.getParentQueue()); + String parent = mapping.getParentQueue(); + CSQueue groupQueue = queueManager.getQueue(group); - if (parent instanceof ManagedParentQueue) { - return getPlacementContext(mapping, group); - } else { - CSQueue queue = this.queueManager.getQueue(group); - if ( queue != null) { - return getPlacementContext(mapping, queue.getQueuePath()); + if (parent != null) { + CSQueue parentQueue = queueManager.getQueue(parent); + + if (parentQueue instanceof ManagedParentQueue) { + return getPlacementContext(mapping, group); } else { - return null; + return groupQueue == null ? null : getPlacementContext(mapping, group); } + } else { + return groupQueue == null ? null : getPlacementContext(mapping, group); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestUserGroupMappingPlacementRule.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestUserGroupMappingPlacementRule.java index 95a0a80..1d7b6b7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestUserGroupMappingPlacementRule.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestUserGroupMappingPlacementRule.java @@ -93,6 +93,7 @@ public class TestUserGroupMappingPlacementRule { when(queueManager.getQueue("bsubgroup2")).thenReturn(bsubgroup2); when(queueManager.getQueue("asubgroup2")).thenReturn(asubgroup2); when(queueManager.getQueue("managedParent")).thenReturn(managedParent); + when(queueManager.getQueue(null)).thenThrow(new NullPointerException()); when(queueManager.getQueue("root.agroup")).thenReturn(agroup); when(queueManager.getQueue("root.bsubgroup2")).thenReturn(bsubgroup2); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org