Kaynağa Gözat

MAPREDUCE-2355. Add a dampner to out-of-band heartbeats. (acmurthy)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-203@1086646 13f79535-47bb-0310-9956-ffa450edef68
Owen O'Malley 14 yıl önce
ebeveyn
işleme
870cd9f485

+ 2 - 0
CHANGES.txt

@@ -2,6 +2,8 @@ Hadoop Change Log
 
 Release 0.20.203.0 - unreleased
 
+    MAPREDUCE-2355. Add a dampner to out-of-band heartbeats. (acmurthy) 
+ 
     HADOOP-7190. Add metrics v1 back for backwards compatibility. (omalley)
 
     MAPREDUCE-2360. Remove stripping of scheme, authority from submit dir in 

+ 9 - 13
src/mapred/org/apache/hadoop/mapred/TaskTracker.java

@@ -1426,25 +1426,21 @@ public class TaskTracker implements MRConstants, TaskUmbilicalProtocol,
         long now = System.currentTimeMillis();
         
         // accelerate to account for multiple finished tasks up-front
-        long remaining = 
-          (lastHeartbeat + getHeartbeatInterval(finishedCount.get())) - now;
-        while (remaining > 0) {
-          // sleeps for the wait time or 
-          // until there are *enough* empty slots to schedule tasks
-          synchronized (finishedCount) {
+        synchronized (finishedCount) {
+          long remaining = 
+            (lastHeartbeat + getHeartbeatInterval(finishedCount.get())) - now;
+          while (remaining > 0) {
+            // sleeps for the wait time or 
+            // until there are *enough* empty slots to schedule tasks
             finishedCount.wait(remaining);
-            
+
             // Recompute
             now = System.currentTimeMillis();
             remaining = 
               (lastHeartbeat + getHeartbeatInterval(finishedCount.get())) - now;
-            
-            if (remaining <= 0) {
-              // Reset count 
-              finishedCount.set(0);
-              break;
-            }
           }
+          // Reset count 
+          finishedCount.set(0);
         }
 
         // If the TaskTracker is just starting up: