hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r515815 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/JobClient.java src/java/org/apache/hadoop/mapred/JobInProgress.java
Date Wed, 07 Mar 2007 22:36:18 GMT
Author: cutting
Date: Wed Mar  7 14:36:17 2007
New Revision: 515815

URL: http://svn.apache.org/viewvc?view=rev&rev=515815
Log:
HADOOP-1060.  Fix an IndexOutOfBoundsException in the JobTracker that could cause jobs to
hang.  Contributed by Arun.

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

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=515815&r1=515814&r2=515815
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Mar  7 14:36:17 2007
@@ -15,6 +15,10 @@
     directory. Also remove dependency on a particular Checkstyle
     version number. (tomwhite)
 
+ 4. HADOOP-1060.  Fix an IndexOutOfBoundsException in the JobTracker
+    that could cause jobs to hang.  (Arun C Murthy via cutting)
+
+
 Release 0.12.0 - 2007-03-02
 
  1. HADOOP-975.  Separate stdout and stderr from tasks.

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java?view=diff&rev=515815&r1=515814&r2=515815
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java Wed Mar  7 14:36:17
2007
@@ -617,11 +617,14 @@
 
     private static void displayTaskLogs(String taskId, String baseUrl)
     throws IOException {
-      // Copy tasks's stdout of the JobClient
-      getTaskLogs(taskId, new URL(baseUrl+"&filter=stdout"), System.out);
-      
-      // Copy task's stderr to stderr of the JobClient 
-      getTaskLogs(taskId, new URL(baseUrl+"&filter=stderr"), System.err);
+      // The tasktracker for a 'failed/killed' job might not be around...
+      if (baseUrl != null) {
+        // Copy tasks's stdout of the JobClient
+        getTaskLogs(taskId, new URL(baseUrl+"&filter=stdout"), System.out);
+        
+        // Copy task's stderr to stderr of the JobClient 
+        getTaskLogs(taskId, new URL(baseUrl+"&filter=stderr"), System.err);
+      }
     }
     
     private static void getTaskLogs(String taskId, URL taskLogUrl, 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java?view=diff&rev=515815&r1=515814&r2=515815
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java Wed Mar  7 14:36:17
2007
@@ -315,26 +315,29 @@
               ttStatus.getHttpPort() + "/tasklog.jsp?plaintext=true&taskid=" +
               status.getTaskId() + "&all=true";
           }
-          
+
+          TaskCompletionEvent taskEvent = null;
           if (state == TaskStatus.State.SUCCEEDED) {
-            this.taskCompletionEvents.add( new TaskCompletionEvent(
-                taskCompletionEventTracker, 
-                status.getTaskId(),
-                tip.idWithinJob(),
-                status.getIsMap(),
-                TaskCompletionEvent.Status.SUCCEEDED,
-                httpTaskLogLocation ));
+            taskEvent = new TaskCompletionEvent(
+                          taskCompletionEventTracker, 
+                          status.getTaskId(),
+                          tip.idWithinJob(),
+                          status.getIsMap(),
+                          TaskCompletionEvent.Status.SUCCEEDED,
+                          httpTaskLogLocation 
+                          );
             tip.setSuccessEventNumber(taskCompletionEventTracker);
             completedTask(tip, status, metrics);
           } else if (state == TaskStatus.State.FAILED ||
                      state == TaskStatus.State.KILLED) {
-            this.taskCompletionEvents.add( new TaskCompletionEvent(
-                taskCompletionEventTracker, 
-                status.getTaskId(),
-                tip.idWithinJob(),
-                status.getIsMap(),
-                TaskCompletionEvent.Status.FAILED, 
-                httpTaskLogLocation ));
+            taskEvent = new TaskCompletionEvent(
+                          taskCompletionEventTracker, 
+                          status.getTaskId(),
+                          tip.idWithinJob(),
+                          status.getIsMap(),
+                          TaskCompletionEvent.Status.FAILED, 
+                          httpTaskLogLocation
+                          );
             // Get the event number for the (possibly) previously successful
             // task. If there exists one, then set that status to OBSOLETE 
             int eventNumber;
@@ -348,9 +351,13 @@
             failedTask(tip, status.getTaskId(), status, status.getTaskTracker(),
                        wasRunning, wasComplete);
           }          
-        }
 
-        taskCompletionEventTracker++;
+          // Add the 'complete' task i.e. successful/failed
+          if (taskEvent != null) {
+            this.taskCompletionEvents.add(taskEvent);
+            taskCompletionEventTracker++;
+          }
+        }
         
         //
         // Update JobInProgress status
@@ -936,8 +943,8 @@
        return null;
     }
     
-    public TaskCompletionEvent[] getTaskCompletionEvents(int fromEventId, 
-        int maxEvents) {
+    synchronized public TaskCompletionEvent[] getTaskCompletionEvents(
+            int fromEventId, int maxEvents) {
       TaskCompletionEvent[] events = TaskCompletionEvent.EMPTY_ARRAY;
       if( taskCompletionEvents.size() > fromEventId) {
         int actualMax = Math.min(maxEvents, 



Mime
View raw message