You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by dd...@apache.org on 2009/02/24 06:23:16 UTC

svn commit: r747279 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/JobInProgress.java src/mapred/org/apache/hadoop/mapred/TaskInProgress.java

Author: ddas
Date: Tue Feb 24 05:23:15 2009
New Revision: 747279

URL: http://svn.apache.org/viewvc?rev=747279&view=rev
Log:
HADOOP-5272. Fixes a problem to do with detecting whether an attempt is the first attempt of a Task. This affects JobTracker restart. Contributed by Amar Kamat.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=747279&r1=747278&r2=747279&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Feb 24 05:23:15 2009
@@ -870,6 +870,9 @@
     HADOOP-5280. Adds a check to prevent a task state transition from FAILED to any of
     UNASSIGNED, RUNNING, COMMIT_PENDING or SUCCEEDED. (ddas) 
 
+    HADOOP-5272. Fixes a problem to do with detecting whether an attempt is the first
+    attempt of a Task. This affects JobTracker restart. (Amar Kamat via ddas)
+
 Release 0.19.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java?rev=747279&r1=747278&r2=747279&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java Tue Feb 24 05:23:15 2009
@@ -1262,6 +1262,12 @@
   synchronized void addRunningTaskToTIP(TaskInProgress tip, TaskAttemptID id, 
                                         TaskTrackerStatus tts, 
                                         boolean isScheduled) {
+    // Make an entry in the tip if the attempt is not scheduled i.e externally
+    // added
+    if (!isScheduled) {
+      tip.addRunningTask(id, tts.getTrackerName());
+    }
+
     // keeping the earlier ordering intact
     String name;
     String splits = "";
@@ -1296,12 +1302,6 @@
       jobCounters.incrCounter(counter, 1);
     }
     
-    // Make an entry in the tip if the attempt is not scheduled i.e externally
-    // added
-    if (!isScheduled) {
-      tip.addRunningTask(id, tts.getTrackerName());
-    }
-
     //TODO The only problem with these counters would be on restart.
     // The jobtracker updates the counter only when the task that is scheduled
     // if from a non-running tip and is local (data, rack ...). But upon restart

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java?rev=747279&r1=747278&r2=747279&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java Tue Feb 24 05:23:15 2009
@@ -90,6 +90,9 @@
     
   // The taskid that took this TIP to SUCCESS
   private TaskAttemptID successfulTaskId;
+
+  // The first taskid of this tip
+  private TaskAttemptID firstTaskId;
   
   // Map from task Id -> TaskTracker Id, contains tasks that are
   // currently runnings
@@ -284,7 +287,7 @@
    * @return Returns true if the Task is the first attempt of the tip
    */  
   public boolean isFirstAttempt(TaskAttemptID taskId) {
-    return (taskId.getId() == 0); 
+    return firstTaskId == null ? false : firstTaskId.equals(taskId); 
   }
   
   /**
@@ -910,7 +913,7 @@
     // create the task
     Task t = null;
     if (isMapTask()) {
-      LOG.debug("attemdpt "+  numTaskFailures   +
+      LOG.debug("attempt "+  numTaskFailures   +
           " sending skippedRecords "+failedRanges.getIndicesCount());
       t = new MapTask(jobFile, taskid, partition, 
           rawSplit.getClassName(), rawSplit.getBytes());
@@ -941,6 +944,11 @@
 
     // Ask JobTracker to note that the task exists
     jobtracker.createTaskEntry(taskid, taskTracker, this);
+
+    // check and set the first attempt
+    if (firstTaskId == null) {
+      firstTaskId = taskid;
+    }
     return t;
   }