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 om...@apache.org on 2011/03/04 05:32:19 UTC

svn commit: r1077587 - /hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java

Author: omalley
Date: Fri Mar  4 04:32:18 2011
New Revision: 1077587

URL: http://svn.apache.org/viewvc?rev=1077587&view=rev
Log:
commit d4dfb8511e24ef731d76d393340ef7aa07b6f982
Author: Arun C Murthy <ac...@apache.org>
Date:   Fri Jul 23 01:09:21 2010 -0700

    MAPREDUCE-339. Fixed the JobInProgress comparator to ensure TIPs aren't lost.

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java?rev=1077587&r1=1077586&r2=1077587&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java Fri Mar  4 04:32:18 2011
@@ -171,7 +171,12 @@ public class JobInProgress {
     new Comparator<TaskInProgress>() {
       @Override
       public int compare(TaskInProgress t1, TaskInProgress t2) {
-        return t2.numTaskFailures() - t1.numTaskFailures();
+        if (t1 == null) return -1;
+        if (t2 == null) return 1;
+        
+        int failures = t2.numTaskFailures() - t1.numTaskFailures();
+        return (failures == 0) ? (t1.getTIPId().getId() - t2.getTIPId().getId())
+            : failures;
       }
     };
 
@@ -1389,7 +1394,7 @@ public class JobInProgress {
   
   /**
    * Check if we can schedule an off-switch task for this job.
-   * @param numTaskTrackers TaskTrackers in the cluster.
+   * 
    * @param numTaskTrackers number of tasktrackers
    * @return <code>true</code> if we can schedule off-switch, 
    *         <code>false</code> otherwise