hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r941564 - in /hadoop/mapreduce/trunk: ./ src/java/org/apache/hadoop/mapred/ src/test/mapred/org/apache/hadoop/mapred/
Date Thu, 06 May 2010 02:21:46 GMT
Author: cdouglas
Date: Thu May  6 02:21:45 2010
New Revision: 941564

URL: http://svn.apache.org/viewvc?rev=941564&view=rev
Log:
MAPREDUCE-1680. Add a metric recording JobTracker heartbeats processed. Contributed by Dick
King

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerInstrumentation.java
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerMetricsInst.java
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobTrackerInstrumentation.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=941564&r1=941563&r2=941564&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Thu May  6 02:21:45 2010
@@ -14,6 +14,9 @@ Trunk (unreleased changes)
     MAPREDUCE-1092. Enable assertions for unit tests. (Eli Collins via
     cdouglas)
 
+    MAPREDUCE-1680. Add a metric recording JobTracker heartbeats processed.
+    (Dick King via cdouglas)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=941564&r1=941563&r2=941564&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Thu May  6 02:21:45
2010
@@ -2664,6 +2664,9 @@ public class JobTracker implements MRCon
   synchronized boolean processHeartbeat(
                                  TaskTrackerStatus trackerStatus, 
                                  boolean initialContact) {
+    
+    getInstrumentation().heartbeat();
+
     String trackerName = trackerStatus.getTrackerName();
 
     synchronized (taskTrackers) {

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerInstrumentation.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerInstrumentation.java?rev=941564&r1=941563&r2=941564&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerInstrumentation.java
(original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerInstrumentation.java
Thu May  6 02:21:45 2010
@@ -158,6 +158,8 @@ class JobTrackerInstrumentation {
   { }
 
   public void setDecommissionedTrackers(int trackers)
-  { }  
+  { }   
 
+  public void heartbeat() {
+  }
 }

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerMetricsInst.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerMetricsInst.java?rev=941564&r1=941563&r2=941564&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerMetricsInst.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobTrackerMetricsInst.java Thu
May  6 02:21:45 2010
@@ -63,6 +63,10 @@ class JobTrackerMetricsInst extends JobT
   private int numTrackers = 0;
   private int numTrackersBlackListed = 0;
   private int numTrackersDecommissioned = 0;
+
+  // long, because 2^31 could well be only about a month's worth of
+  // heartbeats, with reasonable assumptions and JobTracker improvements.
+  private long numHeartbeats = 0L;
   
   public JobTrackerMetricsInst(JobTracker tracker, JobConf conf) {
     super(tracker, conf);
@@ -120,6 +124,8 @@ class JobTrackerMetricsInst extends JobT
       metricsRecord.setMetric("trackers_decommissioned", 
           numTrackersDecommissioned);
 
+      metricsRecord.incrMetric("heartbeats", numHeartbeats);
+
       numMapTasksLaunched = 0;
       numMapTasksCompleted = 0;
       numMapTasksFailed = 0;
@@ -152,6 +158,8 @@ class JobTrackerMetricsInst extends JobT
 
       numTrackers = 0;
       numTrackersBlackListed = 0;
+
+      numHeartbeats = 0L;
     }
     metricsRecord.update();
   }
@@ -399,4 +407,9 @@ class JobTrackerMetricsInst extends JobT
   {
     numTrackersDecommissioned = trackers;
   }  
+
+  @Override
+  public synchronized void heartbeat() {
+    ++numHeartbeats;
+  }
 }

Modified: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobTrackerInstrumentation.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobTrackerInstrumentation.java?rev=941564&r1=941563&r2=941564&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobTrackerInstrumentation.java
(original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobTrackerInstrumentation.java
Thu May  6 02:21:45 2010
@@ -156,6 +156,8 @@ public class TestJobTrackerInstrumentati
     assertTrue("Mismatch in num reduce slots",
         mi.numReduceSlots == (reduceSlotsPerTracker * trackers.length));
 
+    assertTrue("No heartbeats were recorded, but at least one was sent.",
+               mi.numHeartbeats > 0);
   }
   
   public void testBlackListing() throws IOException {
@@ -433,6 +435,8 @@ public class TestJobTrackerInstrumentati
 
     private int numTrackersDecommissioned = 0;
 
+    private long numHeartbeats = 0;
+
     @Override
     public synchronized void launchMap(TaskAttemptID taskAttemptID) {
       ++numMapTasksLaunched;
@@ -676,5 +680,10 @@ public class TestJobTrackerInstrumentati
     {
       numTrackersDecommissioned = trackers;
     }
+
+    @Override
+    public synchronized void heartbeat() {
+      ++numHeartbeats;
+    }
   }
 }



Mime
View raw message