hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m.@apache.org
Subject svn commit: r382895 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
Date Fri, 03 Mar 2006 17:36:10 GMT
Author: mc
Date: Fri Mar  3 09:36:09 2006
New Revision: 382895

URL: http://svn.apache.org/viewcvs?rev=382895&view=rev
Log:

  A bug in the TaskTracker was governing task-allocation
by counting the total number of tasks.  The right thing
to do is keep a total for map tasks, and a separate total
for reduces.  

  This is now fixed.


Modified:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=382895&r1=382894&r2=382895&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Fri Mar  3 09:36:09
2006
@@ -57,6 +57,8 @@
 
     TreeMap tasks = null;
     TreeMap runningTasks = null;
+    int mapTotal = 0;
+    int reduceTotal = 0;
     boolean justStarted = true;
 
     static Random r = new Random();
@@ -224,6 +226,11 @@
                     TaskStatus status = tip.createStatus();
                     taskReports.add(status);
                     if (status.getRunState() != TaskStatus.RUNNING) {
+                        if (tip.getTask().isMapTask()) {
+                            mapTotal--;
+                        } else {
+                            reduceTotal--;
+                        }
                         it.remove();
                     }
                 }
@@ -246,12 +253,17 @@
             //
             // Check if we should create a new Task
             //
-            if (runningTasks.size() < maxCurrentTasks) {
+            if (mapTotal < maxCurrentTasks || reduceTotal < maxCurrentTasks) {
                 Task t = jobClient.pollForNewTask(taskTrackerName);
                 if (t != null) {
                     TaskInProgress tip = new TaskInProgress(t, this.fConf);
                     synchronized (this) {
                       tasks.put(t.getTaskId(), tip);
+                      if (t.isMapTask()) {
+                          mapTotal++;
+                      } else {
+                          reduceTotal++;
+                      }
                       runningTasks.put(t.getTaskId(), tip);
                     }
                     tip.launchTask();



Mime
View raw message