hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r904718 - in /hadoop/mapreduce/branches/branch-0.21: CHANGES.txt src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerBlacklisting.java
Date Sat, 30 Jan 2010 02:57:12 GMT
Author: cdouglas
Date: Sat Jan 30 02:57:12 2010
New Revision: 904718

URL: http://svn.apache.org/viewvc?rev=904718&view=rev
Log:
MAPREDUCE-1412. Fix timer granularity issue causing failures in TestTaskTrackerBlacklisting.

Modified:
    hadoop/mapreduce/branches/branch-0.21/CHANGES.txt
    hadoop/mapreduce/branches/branch-0.21/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerBlacklisting.java

Modified: hadoop/mapreduce/branches/branch-0.21/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/branch-0.21/CHANGES.txt?rev=904718&r1=904717&r2=904718&view=diff
==============================================================================
--- hadoop/mapreduce/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/mapreduce/branches/branch-0.21/CHANGES.txt Sat Jan 30 02:57:12 2010
@@ -937,3 +937,6 @@
 
     MAPREDUCE-1369. JUnit tests should never depend on anything in conf
     (Anatoli Fomenko via cos)
+
+    MAPREDUCE-1412. Fix timer granularity issue causing failures in
+    TestTaskTrackerBlacklisting. (cdouglas)

Modified: hadoop/mapreduce/branches/branch-0.21/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerBlacklisting.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/branch-0.21/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerBlacklisting.java?rev=904718&r1=904717&r2=904718&view=diff
==============================================================================
--- hadoop/mapreduce/branches/branch-0.21/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerBlacklisting.java
(original)
+++ hadoop/mapreduce/branches/branch-0.21/src/test/mapred/org/apache/hadoop/mapred/TestTaskTrackerBlacklisting.java
Sat Jan 30 02:57:12 2010
@@ -20,8 +20,8 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.Map.Entry;
@@ -53,22 +53,19 @@
 
   private static short responseId;
 
-  private static HashSet<ReasonForBlackListing> nodeUnHealthyReasonSet = 
-    new HashSet<ReasonForBlackListing>();
+  private static final Set<ReasonForBlackListing> nodeUnHealthyReasonSet =
+    EnumSet.of(ReasonForBlackListing.NODE_UNHEALTHY);
 
-  private static HashSet<ReasonForBlackListing> exceedsFailuresReasonSet = 
-    new HashSet<ReasonForBlackListing>();
+  private static final Set<ReasonForBlackListing> exceedsFailuresReasonSet =
+    EnumSet.of(ReasonForBlackListing.EXCEEDING_FAILURES);
 
-  private static HashSet<ReasonForBlackListing> unhealthyAndExceedsFailure = 
-    new HashSet<ReasonForBlackListing>();
+  private static final Set<ReasonForBlackListing>
+    unhealthyAndExceedsFailure = EnumSet.of(
+        ReasonForBlackListing.NODE_UNHEALTHY,
+        ReasonForBlackListing.EXCEEDING_FAILURES);
 
-  static {
-    nodeUnHealthyReasonSet.add(ReasonForBlackListing.NODE_UNHEALTHY);
-    exceedsFailuresReasonSet.add(ReasonForBlackListing.EXCEEDING_FAILURES);
-    unhealthyAndExceedsFailure.add(ReasonForBlackListing.NODE_UNHEALTHY);
-    unhealthyAndExceedsFailure.add(ReasonForBlackListing.EXCEEDING_FAILURES);
-  }
-  private static final long aDay = 24 * 60 * 60 * 1000;
+  // Add extra millisecond where timer granularity is too coarse
+  private static final long aDay = 24 * 60 * 60 * 1000 + 1;
 
   private static class FakeJobTrackerClock extends Clock {
     boolean jumpADay = false;
@@ -186,8 +183,8 @@
     checkReasonForBlackListing(hosts[0], exceedsFailuresReasonSet);
     clock.jumpADay = true;
     sendHeartBeat(null, false);
-    assertEquals("Tracker 1 still blacklisted after a day", jobTracker
-        .getBlacklistedTrackerCount(), 0);
+    assertEquals("Tracker 1 still blacklisted after a day", 0, jobTracker
+        .getBlacklistedTrackerCount());
     //Cleanup the blacklisted trackers.
     //Tracker is black listed due to failure count, so clock has to be
     //forwarded by a day.
@@ -207,8 +204,8 @@
     //white list tracker so the further test cases can be
     //using trackers.
     sendHeartBeat(status, false);
-    assertEquals("Trackers still blacklisted after healthy report", jobTracker
-        .getBlacklistedTrackerCount(), 0);
+    assertEquals("Trackers still blacklisted after healthy report", 0,
+        jobTracker.getBlacklistedTrackerCount());
   }
   
   
@@ -265,15 +262,15 @@
 
   public void testBlackListingWithFailuresAndHealthStatus() throws Exception {
     runBlackListingJob(jobTracker, trackers);
-    assertEquals("Tracker 1 not blacklisted", jobTracker
-        .getBlacklistedTrackerCount(), 1);
+    assertEquals("Tracker 1 not blacklisted", 1,
+        jobTracker.getBlacklistedTrackerCount());
     checkReasonForBlackListing(hosts[0], exceedsFailuresReasonSet);
     TaskTrackerHealthStatus status = getUnhealthyNodeStatus("ERROR");
     
     sendHeartBeat(status, false);
 
-    assertEquals("All trackers not blacklisted", 
-        jobTracker.getBlacklistedTrackerCount(), 3);
+    assertEquals("All trackers not blacklisted", 3,
+        jobTracker.getBlacklistedTrackerCount());
     checkReasonForBlackListing(hosts[0], unhealthyAndExceedsFailure);
     checkReasonForBlackListing(hosts[1], nodeUnHealthyReasonSet);
     checkReasonForBlackListing(hosts[2], nodeUnHealthyReasonSet);
@@ -281,8 +278,8 @@
     clock.jumpADay = true;
     sendHeartBeat(status, false);
     
-    assertEquals("All trackers not blacklisted", 
-        jobTracker.getBlacklistedTrackerCount(), 3);
+    assertEquals("All trackers not blacklisted", 3,
+        jobTracker.getBlacklistedTrackerCount());
     
     for (String host : hosts) {
       checkReasonForBlackListing(host, nodeUnHealthyReasonSet);
@@ -290,8 +287,8 @@
     //clear blacklisted trackers due to node health reasons.
     sendHeartBeat(null, false);
     
-    assertEquals("All trackers not white listed", 
-        jobTracker.getBlacklistedTrackerCount(), 0);
+    assertEquals("All trackers not white listed", 0,
+        jobTracker.getBlacklistedTrackerCount());
     //Clear the blacklisted trackers due to failures.
     clock.jumpADay = false;
   }
@@ -302,8 +299,8 @@
     TaskTrackerHealthStatus status = getUnhealthyNodeStatus(error);
     sendHeartBeat(status, false);
 
-    assertEquals("All trackers not blacklisted", jobTracker
-        .getBlacklistedTrackerCount(), 3);
+    assertEquals("All trackers not blacklisted", 3,
+        jobTracker.getBlacklistedTrackerCount());
 
     checkReasonForBlackListing(hosts[0], nodeUnHealthyReasonSet);
     checkReasonForBlackListing(hosts[1], nodeUnHealthyReasonSet);
@@ -312,8 +309,8 @@
       //Replace new line as we are adding new line
       //in getFaultReport
       assertEquals("Blacklisting reason string not correct for host " + i,
-          jobTracker.getFaultReport(hosts[i]).replace("\n", ""),
-          error);
+          error,
+          jobTracker.getFaultReport(hosts[i]).replace("\n", ""));
     }
     status.setNodeHealthy(false);
     status.setLastReported(System.currentTimeMillis());
@@ -326,8 +323,8 @@
       //Replace new line as we are adding new line
       //in getFaultReport
       assertEquals("Blacklisting reason string not correct for host " + i,
-          jobTracker.getFaultReport(hosts[i]).replace("\n", ""),
-          error1);
+          error1,
+          jobTracker.getFaultReport(hosts[i]).replace("\n", ""));
     }
     //clear the blacklisted trackers with node health reasons.
     sendHeartBeat(null, false);
@@ -361,14 +358,14 @@
         .getNumReservedTaskTrackersForMaps());
     assertEquals("Tracker 1 not unreserved for the job 1", 1, job
         .getNumReservedTaskTrackersForReduces());
-    assertEquals("Tracker 1 not blacklisted", jobTracker
-        .getBlacklistedTrackerCount(), 1);
+    assertEquals("Tracker 1 not blacklisted", 1, jobTracker
+        .getBlacklistedTrackerCount());
     checkReasonForBlackListing(hosts[0], exceedsFailuresReasonSet);
     
     TaskTrackerHealthStatus status = getUnhealthyNodeStatus("ERROR");
     sendHeartBeat(status, false);
-    assertEquals("All trackers not blacklisted", jobTracker
-        .getBlacklistedTrackerCount(), 3);
+    assertEquals("All trackers not blacklisted", 3,
+        jobTracker.getBlacklistedTrackerCount());
     
     checkReasonForBlackListing(hosts[0], unhealthyAndExceedsFailure);
     checkReasonForBlackListing(hosts[1], nodeUnHealthyReasonSet);
@@ -403,8 +400,8 @@
     TaskTrackerHealthStatus status = getUnhealthyNodeStatus(errorWithNewLines);
     // make all tracker unhealthy
     sendHeartBeat(status, false);
-    assertEquals("All trackers not blacklisted", jobTracker
-        .getBlacklistedTrackerCount(), 3);
+    assertEquals("All trackers not blacklisted", 3, jobTracker
+        .getBlacklistedTrackerCount());
     // Verify the new method .getBlackListedTracker() which is
     // used by the ClusterStatus to set the list of blacklisted
     // tracker.



Mime
View raw message