hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1394331 - in /hadoop/common/branches/branch-1: CHANGES.txt src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolSchedulable.java
Date Thu, 04 Oct 2012 23:55:27 GMT
Author: tucu
Date: Thu Oct  4 23:55:26 2012
New Revision: 1394331

URL: http://svn.apache.org/viewvc?rev=1394331&view=rev
Log:
MAPREDUCE-4556. FairScheduler: PoolSchedulable#updateDemand() has potential redundant computation
(kkambatl via tucu)

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolSchedulable.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1394331&r1=1394330&r2=1394331&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Thu Oct  4 23:55:26 2012
@@ -81,6 +81,9 @@ Release 1.2.0 - unreleased
     MAPREDUCE-4464. Reduce tasks failing with NullPointerException in
     ConcurrentHashMap.get(). (Clint Heath via harsh)
 
+    MAPREDUCE-4556. FairScheduler: PoolSchedulable#updateDemand() has potential 
+    redundant computation (kkambatl via tucu)
+
   OPTIMIZATIONS
 
     HDFS-2533. Backport: Remove needless synchronization on some FSDataSet

Modified: hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolSchedulable.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolSchedulable.java?rev=1394331&r1=1394330&r2=1394331&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolSchedulable.java
(original)
+++ hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolSchedulable.java
Thu Oct  4 23:55:26 2012
@@ -79,15 +79,20 @@ public class PoolSchedulable extends Sch
    */
   @Override
   public void updateDemand() {
+    // limit the demand to maxTasks
+    int maxTasks = poolMgr.getMaxSlots(pool.getName(), taskType);
     demand = 0;
     for (JobSchedulable sched: jobScheds) {
       sched.updateDemand();
       demand += sched.getDemand();
+      if (demand >= maxTasks) {
+        demand = maxTasks;
+        break;
+      }
     }
-    // if demand exceeds the cap for this pool, limit to the max
-    int maxTasks = poolMgr.getMaxSlots(pool.getName(), taskType);
-    if(demand > maxTasks) {
-      demand = maxTasks;
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("The pool " + pool.getName() + " demand is " + demand
+          + "; maxTasks is " + maxTasks);
     }
   }
   



Mime
View raw message