Ver código fonte

YARN-11071. AutoCreatedQueueTemplate incorrect wildcard level. Contributed by Tamas Domok

Szilard Nemeth 3 anos atrás
pai
commit
d58c10c3a5

+ 1 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AutoCreatedQueueTemplate.java

@@ -170,8 +170,7 @@ public class AutoCreatedQueueTemplate {
     int wildcardLevel = 0;
     // root can not be wildcarded
     // MAX_WILDCARD_LEVEL will be configurable in the future
-    int supportedWildcardLevel = Math.min(queuePathMaxIndex - 1,
-        MAX_WILDCARD_LEVEL);
+    int supportedWildcardLevel = Math.min(queuePathMaxIndex, MAX_WILDCARD_LEVEL);
     // Allow root to have template properties
     if (queuePath.isRoot()) {
       supportedWildcardLevel = 0;

+ 11 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestAutoCreatedQueueTemplate.java

@@ -88,6 +88,17 @@ public class TestAutoCreatedQueueTemplate {
         conf.getNonLabeledQueueWeight(ROOT), 10e-6);
   }
 
+  @Test
+  public void testWildcardAfterRoot() {
+    conf.set(getTemplateKey("root.*", "acl_submit_applications"), "user");
+    AutoCreatedQueueTemplate template =
+        new AutoCreatedQueueTemplate(conf, new QueuePath("root.a"));
+    template.setTemplateEntriesForChild(conf, "root.a");
+
+    Assert.assertEquals("acl_submit_applications is set", "user",
+        template.getTemplateProperties().get("acl_submit_applications"));
+  }
+
   @Test
   public void testTemplatePrecedence() {
     conf.set(getTemplateKey("root.a.b", "capacity"), "6w");