hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r539132 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/TaskTracker.java
Date Thu, 17 May 2007 21:50:11 GMT
Author: cutting
Date: Thu May 17 14:50:10 2007
New Revision: 539132

URL: http://svn.apache.org/viewvc?view=rev&rev=539132
Log:
HADOOP-1369.  Fix inconsistent synchronization in TaskTracker.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=539132&r1=539131&r2=539132
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Thu May 17 14:50:10 2007
@@ -425,6 +425,9 @@
 119. HADOOP-1368.  Fix inconsistent synchronization in JobInProgress.
      (omalley via cutting)
 
+120. HADOOP-1369.  Fix inconsistent synchronization in TaskTracker.
+     (omalley via cutting)
+
 
 Release 0.12.3 - 2007-04-06
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?view=diff&rev=539132&r1=539131&r2=539132
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Thu May 17 14:50:10
2007
@@ -24,7 +24,6 @@
 import java.io.PrintStream;
 import java.net.BindException;
 import java.net.InetSocketAddress;
-import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -37,8 +36,6 @@
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.regex.Pattern;
-import java.util.Collections;
-import java.util.Collection;
 
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
@@ -803,17 +800,17 @@
     // else resend the previous status information.
     //
     if (status == null) {
-      List<TaskStatus> taskReports = 
-        new ArrayList<TaskStatus>(runningTasks.size());
       synchronized (this) {
+        List<TaskStatus> taskReports = 
+          new ArrayList<TaskStatus>(runningTasks.size());
         for (TaskInProgress tip: runningTasks.values()) {
           taskReports.add(tip.createStatus());
         }
+        status = 
+          new TaskTrackerStatus(taskTrackerName, localHostname, 
+                                httpPort, taskReports, 
+                                failures); 
       }
-      status = 
-        new TaskTrackerStatus(taskTrackerName, localHostname, 
-                              httpPort, taskReports, 
-                              failures); 
     } else {
       LOG.info("Resending 'status' to '" + jobTrackAddr.getHostName() +
                "' with reponseId '" + heartbeatResponseId);
@@ -822,14 +819,15 @@
     //
     // Check if we should ask for a new Task
     //
-    boolean askForNewTask = false; 
-    if ((mapTotal < maxCurrentTasks || reduceTotal < maxCurrentTasks) &&
-        acceptNewTasks) {
+    boolean askForNewTask;
+    synchronized (this) {
+      askForNewTask = (mapTotal < maxCurrentTasks || 
+                       reduceTotal < maxCurrentTasks) &&
+                      acceptNewTasks; 
+    }
+    if (askForNewTask) {
       checkLocalDirs(fConf.getLocalDirs());
-        
-      if (enoughFreeSpace(minSpaceStart)) {
-        askForNewTask = true;
-      }
+      askForNewTask = enoughFreeSpace(minSpaceStart);
     }
       
     //
@@ -1453,7 +1451,7 @@
     /**
      * The map output has been lost.
      */
-    public synchronized void mapOutputLost(String failure
+    private synchronized void mapOutputLost(String failure
                                            ) throws IOException {
       if (runstate == TaskStatus.State.SUCCEEDED) {
         LOG.info("Reporting output lost:"+task.getTaskId());



Mime
View raw message