hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r525774 - in /lucene/hadoop/branches/branch-0.12: CHANGES.txt src/java/org/apache/hadoop/mapred/TaskTracker.java
Date Thu, 05 Apr 2007 09:21:05 GMT
Author: tomwhite
Date: Thu Apr  5 02:21:05 2007
New Revision: 525774

URL: http://svn.apache.org/viewvc?view=rev&rev=525774
Log:
HADOOP-1179. Merge -r 525499:525500 from trunk to 0.12 branch.

Modified:
    lucene/hadoop/branches/branch-0.12/CHANGES.txt
    lucene/hadoop/branches/branch-0.12/src/java/org/apache/hadoop/mapred/TaskTracker.java

Modified: lucene/hadoop/branches/branch-0.12/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.12/CHANGES.txt?view=diff&rev=525774&r1=525773&r2=525774
==============================================================================
--- lucene/hadoop/branches/branch-0.12/CHANGES.txt (original)
+++ lucene/hadoop/branches/branch-0.12/CHANGES.txt Thu Apr  5 02:21:05 2007
@@ -26,6 +26,10 @@
  7. HADOOP-1105. Fix reducers to make "progress" while iterating 
     through values.  (Devaraj Das & Owen O'Malley via tomwhite)
 
+ 8. HADOOP-1179. Make Task Tracker close index file as soon as the read 
+    is done when serving get-map-output requests.  
+    (Devaraj Das via tomwhite)
+
 
 Release 0.12.2 - 2007-23-17
 

Modified: lucene/hadoop/branches/branch-0.12/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.12/src/java/org/apache/hadoop/mapred/TaskTracker.java?view=diff&rev=525774&r1=525773&r2=525774
==============================================================================
--- lucene/hadoop/branches/branch-0.12/src/java/org/apache/hadoop/mapred/TaskTracker.java
(original)
+++ lucene/hadoop/branches/branch-0.12/src/java/org/apache/hadoop/mapred/TaskTracker.java
Thu Apr  5 02:21:05 2007
@@ -1643,6 +1643,9 @@
           long startOffset = indexIn.readLong();
           long partLength = indexIn.readLong();
 
+          indexIn.close();
+          indexIn = null;
+          
           //set the content-length header
           response.setContentLength((int) partLength);
 
@@ -1654,31 +1657,23 @@
           mapOutputIn = fileSys.open(mapOutputFileName);
           //seek to the correct offset for the reduce
           mapOutputIn.seek(startOffset);
-          try {
-            int totalRead = 0;
-            int len = mapOutputIn.read(buffer, 0,
-                                 partLength < MAX_BYTES_TO_READ 
-                                 ? (int)partLength : MAX_BYTES_TO_READ);
-            while (len > 0) {
-              try {
-                outStream.write(buffer, 0, len);
-              } catch (IOException ie) {
-                isInputException = false;
-                throw ie;
-              }
-              totalRead += len;
-              if (totalRead == partLength) break;
-              len = mapOutputIn.read(buffer, 0, 
-                      (partLength - totalRead) < MAX_BYTES_TO_READ
-                       ? (int)(partLength - totalRead) : MAX_BYTES_TO_READ);
-            }
-          } finally {
-            if (indexIn != null) {
-              indexIn.close();
-            }
-            if (mapOutputIn != null) {
-              mapOutputIn.close();
+          
+          int totalRead = 0;
+          int len = mapOutputIn.read(buffer, 0,
+                               partLength < MAX_BYTES_TO_READ 
+                               ? (int)partLength : MAX_BYTES_TO_READ);
+          while (len > 0) {
+            try {
+              outStream.write(buffer, 0, len);
+            } catch (IOException ie) {
+              isInputException = false;
+              throw ie;
             }
+            totalRead += len;
+            if (totalRead == partLength) break;
+            len = mapOutputIn.read(buffer, 0, 
+                    (partLength - totalRead) < MAX_BYTES_TO_READ
+                     ? (int)(partLength - totalRead) : MAX_BYTES_TO_READ);
           }
         } catch (IOException ie) {
           TaskTracker tracker = 
@@ -1693,7 +1688,14 @@
           }
           response.sendError(HttpServletResponse.SC_GONE, errorMsg);
           throw ie;
-        } 
+        } finally {
+          if (indexIn != null) {
+            indexIn.close();
+          }
+          if (mapOutputIn != null) {
+            mapOutputIn.close();
+          }
+        }
         outStream.close();
       }
     }



Mime
View raw message