1
0
فهرست منبع

HADOOP-5276. Applied the patch on the 0.20 branch as well.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20@752924 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 16 سال پیش
والد
کامیت
9c043410a6
3فایلهای تغییر یافته به همراه30 افزوده شده و 0 حذف شده
  1. 3 0
      CHANGES.txt
  2. 6 0
      src/mapred/org/apache/hadoop/mapred/JobInProgress.java
  3. 21 0
      src/test/org/apache/hadoop/mapred/TestLostTracker.java

+ 3 - 0
CHANGES.txt

@@ -700,6 +700,9 @@ Release 0.20.0 - Unreleased
     HADOOP-5395. Change the exception message when a job is submitted to an
     invalid queue. (Rahul Kumar Singh via yhemanth)
 
+    HADOOP-5276. Fixes a problem to do with updating the start time of a task when
+    the tracker that ran the task is lost. (Amar Kamat via ddas)
+
 Release 0.19.2 - Unreleased
 
   BUG FIXES

+ 6 - 0
src/mapred/org/apache/hadoop/mapred/JobInProgress.java

@@ -2426,6 +2426,12 @@ class JobInProgress {
                                                     reason,
                                                     trackerName, phase,
                                                     new Counters());
+    // update the actual start-time of the attempt
+    TaskStatus oldStatus = tip.getTaskStatus(taskid); 
+    long startTime = oldStatus == null
+                     ? System.currentTimeMillis()
+                     : oldStatus.getStartTime();
+    status.setStartTime(startTime);
     status.setFinishTime(System.currentTimeMillis());
     boolean wasComplete = tip.isComplete();
     updateTaskStatus(tip, status, metrics);

+ 21 - 0
src/test/org/apache/hadoop/mapred/TestLostTracker.java

@@ -94,8 +94,29 @@ public class TestLostTracker extends TestCase {
     assertTrue(tip.isComplete());
     assertEquals(tip.numKilledTasks(), 1);
     
+    // check if the task statuses for the tasks are sane
+    JobTracker jt = mr.getJobTrackerRunner().getJobTracker();
+    for (TaskInProgress taskInProgress : jt.getJob(id).getMapTasks()) {
+      testTaskStatuses(taskInProgress.getTaskStatuses());
+    }
+    
   }
   
+  private void testTaskStatuses(TaskStatus[] tasks) {
+    for (TaskStatus status : tasks) {
+      assertTrue("Invalid start time " + status.getStartTime(), 
+                 status.getStartTime() > 0);
+      assertTrue("Invalid finish time " + status.getFinishTime(), 
+                 status.getFinishTime() > 0);
+      assertTrue("Start time (" + status.getStartTime() + ") is greater than " 
+                 + "the finish time (" + status.getFinishTime() + ")", 
+                 status.getStartTime() <= status.getFinishTime());
+      assertNotNull("Task phase information is null", status.getPhase());
+      assertNotNull("Task run-state information is null", status.getRunState());
+      assertNotNull("TaskTracker information is null", status.getTaskTracker());
+    }
+  }
+
   public void testLostTracker() throws IOException {
     String namenode = null;
     MiniDFSCluster dfs = null;