hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r747289 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/JobInProgress.java src/test/org/apache/hadoop/mapred/TestLostTracker.java
Date Tue, 24 Feb 2009 06:48:52 GMT
Author: ddas
Date: Tue Feb 24 06:48:52 2009
New Revision: 747289

URL: http://svn.apache.org/viewvc?rev=747289&view=rev
Log:
HADOOP-5276. Fixes a problem to do with updating the start time of a task when the tracker
that ran the task is lost. 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/test/org/apache/hadoop/mapred/TestLostTracker.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=747289&r1=747288&r2=747289&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Feb 24 06:48:52 2009
@@ -221,6 +221,9 @@
     HADOOP-5300. Fix ant javadoc-dev target and the typo in the class name
     NameNodeActivtyMBean.  (szetszwo)
 
+    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.20.0 - Unreleased
 
   INCOMPATIBLE CHANGES

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=747289&r1=747288&r2=747289&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 06:48:52
2009
@@ -2426,6 +2426,12 @@
                                                     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);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestLostTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestLostTracker.java?rev=747289&r1=747288&r2=747289&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestLostTracker.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestLostTracker.java Tue Feb 24 06:48:52
2009
@@ -94,8 +94,29 @@
     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;



Mime
View raw message