Przeglądaj źródła

MAPREDUCE-2630. refreshQueues leads to NPEs when used w/FifoScheduler. (Josh Willis via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/MR-279@1145844 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 14 lat temu
rodzic
commit
925226f65a

+ 4 - 1
mapreduce/CHANGES.txt

@@ -4,7 +4,10 @@ Trunk (unreleased changes)
 
 
     MAPREDUCE-279
-
+   
+    MAPREDUCE-2630. refreshQueues leads to NPEs when used w/FifoScheduler. 
+    (Josh Willis via mahadev)
+ 
     MAPREDUCE-2678. minimum-user-limit-percent no longer honored. (naisbitt 
     via mahadev)
 

+ 14 - 8
mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java

@@ -100,6 +100,7 @@ public class FifoScheduler implements ResourceScheduler {
   public static final String MAXIMUM_ALLOCATION = 
     FIFO_PREFIX + "maximum-allocation-mb";
 
+  private boolean initialized;
   private Resource minimumAllocation;
   private Resource maximumAllocation;
 
@@ -187,14 +188,19 @@ public class FifoScheduler implements ResourceScheduler {
       ClusterTracker clusterTracker) 
   throws IOException 
   {
-    this.conf = conf;
-    this.containerTokenSecretManager = containerTokenSecretManager;
-    this.clusterTracker = clusterTracker;
-    if (clusterTracker != null) this.clusterTracker.addListener(this);
-    this.minimumAllocation = 
-      Resources.createResource(conf.getInt(MINIMUM_ALLOCATION, MINIMUM_MEMORY));
-    this.maximumAllocation = 
-      Resources.createResource(conf.getInt(MAXIMUM_ALLOCATION, MAXIMUM_MEMORY));
+    if (!this.initialized) {
+      this.conf = conf;
+      this.containerTokenSecretManager = containerTokenSecretManager;
+      this.clusterTracker = clusterTracker;
+      if (clusterTracker != null) this.clusterTracker.addListener(this);
+      this.minimumAllocation = 
+        Resources.createResource(conf.getInt(MINIMUM_ALLOCATION, MINIMUM_MEMORY));
+      this.maximumAllocation = 
+        Resources.createResource(conf.getInt(MAXIMUM_ALLOCATION, MAXIMUM_MEMORY));
+      this.initialized = true;
+    } else {
+      this.conf = conf;
+    }
   }
 
   @Override