瀏覽代碼

commit b7b8dac3a29d1dc2dee941a0b8825df50bbd1821
Author: Yahoo\! <ltucker@yahoo-inc.com>
Date: Tue Aug 18 09:16:07 2009 -0700

Apply patch for MAPREDUCE:682 from: http://issues.apache.org/jira/secure/attachment/12414313/mapreduce-682-ydist.patch


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1076977 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 年之前
父節點
當前提交
83e599ac48

+ 8 - 1
src/mapred/org/apache/hadoop/mapred/JobTracker.java

@@ -711,6 +711,13 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
       } else {
         LOG.info("Blacklisting tracker : " + hostName 
             + " Reason for blacklisting is : " + rfb);
+        Set<TaskTracker> trackers = 
+          hostnameToTaskTracker.get(hostName);
+        synchronized (trackers) {
+          for (TaskTracker tracker : trackers) {
+            tracker.cancelAllReservations();
+          }
+        }
         removeHostCapacity(hostName);
         fi.setBlacklist(rfb, reason);
       }
@@ -4147,7 +4154,7 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
       }
 
       // Cleanup
-      taskTracker.lost();
+      taskTracker.cancelAllReservations();
 
       // Purge 'marked' tasks, needs to be done  
       // here to prevent hanging references!

+ 6 - 3
src/mapred/org/apache/hadoop/mapreduce/server/jobtracker/TaskTracker.java

@@ -183,10 +183,13 @@ public class TaskTracker {
   }
   
   /**
-   * Cleanup when the {@link TaskTracker} is declared as 'lost' by the 
-   * JobTracker.
+   * Cleanup when the {@link TaskTracker} is declared as 'lost/blacklisted'
+   * by the JobTracker.
+   * 
+   * The method assumes that the lock on the {@link JobTracker} is obtained
+   * by the caller.
    */
-  public void lost() {
+  public void cancelAllReservations() {
     // Inform jobs which have reserved slots on this tasktracker
     if (jobForFallowMapSlot != null) {
       unreserveSlots(TaskType.MAP, jobForFallowMapSlot);