Browse Source

MAPREDUCE-2569. Ensure root queue allocated 100% capacity.
Contributed by Jonathan Eagles


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/MR-279@1135854 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 14 years ago
parent
commit
58af5b2aca

+ 5 - 2
mapreduce/CHANGES.txt

@@ -5,10 +5,13 @@ Trunk (unreleased changes)
 
     MAPREDUCE-279
 
+    MAPREDUCE-2569. Ensure root queue allocated 100% capacity. (Jonathan
+    Eagles via cdouglas)
+
     Changes to do rack resolutions in the RM and in the AM (ddas)
-   
+
     Fix NPE in history event handling (siddharth seth via mahadev)
-    
+
     Job level node blacklisting. (sharad)
 
     Fixing the bug which was causing FAILED jobs to be displayed as COMPLETED

+ 10 - 2
mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ParentQueue.java

@@ -108,8 +108,16 @@ public class ParentQueue implements Queue {
         QueueMetrics.forQueue(getQueuePath(), parent,
         cs.getConfiguration().getEnableUserMetrics());
 
-    float capacity = 
-      (float)cs.getConfiguration().getCapacity(getQueuePath()) / 100;
+    int rawCapacity = cs.getConfiguration().getCapacity(getQueuePath());
+
+    if (rootQueue &&
+        (rawCapacity != CapacitySchedulerConfiguration.MAXIMUM_CAPACITY_VALUE)) {
+      throw new IllegalArgumentException("Illegal " +
+          "capacity of " + rawCapacity + " for queue " + queueName +
+          ". Must be " + CapacitySchedulerConfiguration.MAXIMUM_CAPACITY_VALUE);
+    }
+
+    float capacity = (float) rawCapacity / 100;
 
     float parentAbsoluteCapacity = 
       (parent == null) ? 1.0f : parent.getAbsoluteCapacity();

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

@@ -93,4 +93,15 @@ public class TestQueueParsing {
     
     LOG.info("Setup 3rd-level queues");
   }
+
+  @Test (expected=java.lang.IllegalArgumentException.class)
+  public void testRootQueueParsing() throws Exception {
+    CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
+
+    // non-100 percent value will throw IllegalArgumentException
+    conf.setCapacity(CapacityScheduler.ROOT, 90);
+
+    CapacityScheduler capacityScheduler = new CapacityScheduler();
+    capacityScheduler.reinitialize(conf, null, null);
+  }
 }