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:26:13 UTC

svn commit: r747280 - in /hadoop/core/branches/branch-0.20: ./ 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:26:12 2009
New Revision: 747280

URL: http://svn.apache.org/viewvc?rev=747280&view=rev
Log:
Merge -r 747278:747279 from trunk onto 0.20 branch. Fixes HADOOP-5272.

Modified:
    hadoop/core/branches/branch-0.20/   (props changed)
    hadoop/core/branches/branch-0.20/CHANGES.txt   (contents, props changed)
    hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
    hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java

Propchange: hadoop/core/branches/branch-0.20/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 24 05:26:12 2009
@@ -1,2 +1,2 @@
 /hadoop/core/branches/branch-0.19:713112
-/hadoop/core/trunk:727001,727117,727191,727212,727217,727228,727255,727869,728187,729052,729987,732385,732572,732613,732777,732838,732869,733887,734870,734916,736426,738328,738697,740077,740157,741703,741762,743745,743816,743892,744894,745180,746010,746206,746227,746233,746274,746902-746903,746944,746968,746970
+/hadoop/core/trunk:727001,727117,727191,727212,727217,727228,727255,727869,728187,729052,729987,732385,732572,732613,732777,732838,732869,733887,734870,734916,736426,738328,738697,740077,740157,741703,741762,743745,743816,743892,744894,745180,746010,746206,746227,746233,746274,746902-746903,746944,746968,746970,747279

Modified: hadoop/core/branches/branch-0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/CHANGES.txt?rev=747280&r1=747279&r2=747280&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.20/CHANGES.txt Tue Feb 24 05:26:12 2009
@@ -658,6 +658,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

Propchange: hadoop/core/branches/branch-0.20/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 24 05:26:12 2009
@@ -1,3 +1,3 @@
 /hadoop/core/branches/branch-0.18/CHANGES.txt:727226
 /hadoop/core/branches/branch-0.19/CHANGES.txt:713112
-/hadoop/core/trunk/CHANGES.txt:727001,727117,727191,727212,727228,727255,727869,728187,729052,729987,732385,732572,732613,732777,732838,732869,733887,734870,734916,735082,736426,738602,738697,739416,740077,740157,741703,741762,743296,743745,743816,743892,744894,745180,745268,746010,746193,746206,746227,746233,746274,746902-746903,746944,746968,746970
+/hadoop/core/trunk/CHANGES.txt:727001,727117,727191,727212,727228,727255,727869,728187,729052,729987,732385,732572,732613,732777,732838,732869,733887,734870,734916,735082,736426,738602,738697,739416,740077,740157,741703,741762,743296,743745,743816,743892,744894,745180,745268,746010,746193,746206,746227,746233,746274,746902-746903,746944,746968,746970,747279

Modified: hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/JobInProgress.java?rev=747280&r1=747279&r2=747280&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/JobInProgress.java Tue Feb 24 05:26:12 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/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java?rev=747280&r1=747279&r2=747280&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java (original)
+++ hadoop/core/branches/branch-0.20/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java Tue Feb 24 05:26:12 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;
   }