Browse Source

Fix a couple of tasktracker bugs.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@382937 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 years ago
parent
commit
7d178223d6

+ 5 - 2
src/java/org/apache/hadoop/mapred/TaskInProgress.java

@@ -39,7 +39,7 @@ import java.util.logging.*;
 //
 ////////////////////////////////////////////////////////
 class TaskInProgress {
-    static final int MAX_TASK_EXECS = 10;
+    static final int MAX_TASK_EXECS = 1;
     static final int MAX_TASK_FAILURES = 4;    
     static final double SPECULATIVE_GAP = 0.2;
     static final long SPECULATIVE_LAG = 60 * 1000;
@@ -157,12 +157,14 @@ class TaskInProgress {
     public boolean isFailed() {
         return failed;
     }
+
     /**
      * Number of times the TaskInProgress has failed.
      */
     public int numTaskFailures() {
-        return numTaskFailures();
+        return numTaskFailures;
     }
+
     /**
      * Get the overall progress (from 0 to 1.0) for this TIP
      */
@@ -405,6 +407,7 @@ class TaskInProgress {
         // in more depth eventually...
         //
         if (isMapTask() &&
+            recentTasks.size() <= MAX_TASK_EXECS &&
             conf.getBoolean("mapred.speculative.execution", true) &&
             (averageProgress - progress >= SPECULATIVE_GAP) &&
             (System.currentTimeMillis() - startTime >= SPECULATIVE_LAG)) {

+ 8 - 3
src/java/org/apache/hadoop/mapred/TaskTracker.java

@@ -106,6 +106,8 @@ public class TaskTracker implements MRConstants, TaskUmbilicalProtocol, MapOutpu
         // Clear out state tables
         this.tasks = new TreeMap();
         this.runningTasks = new TreeMap();
+        this.mapTotal = 0;
+        this.reduceTotal = 0;
 
         // port numbers
         this.taskReportPort = this.fConf.getInt("mapred.task.tracker.report.port", 50050);
@@ -326,8 +328,7 @@ public class TaskTracker implements MRConstants, TaskUmbilicalProtocol, MapOutpu
                                 staleState = true;
                             }
                         } catch (Exception ex) {
-                            ex.printStackTrace();
-                            LOG.info("Lost connection to JobTracker [" + jobTrackAddr + "].  Retrying...");
+                            LOG.log(Level.INFO, "Lost connection to JobTracker [" + jobTrackAddr + "].  Retrying...", ex);
                             try {
                                 Thread.sleep(5000);
                             } catch (InterruptedException ie) {
@@ -632,7 +633,11 @@ public class TaskTracker implements MRConstants, TaskUmbilicalProtocol, MapOutpu
      */
     synchronized void reportTaskFinished(String taskid) {
         TaskInProgress tip = (TaskInProgress) tasks.get(taskid);
-        tip.taskFinished();
+        if (tip != null) {
+          tip.taskFinished();
+        } else {
+          LOG.warning("Unknown child task finshed: "+taskid+". Ignored.");
+        }
     }
 
     /**