You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by to...@apache.org on 2007/04/04 14:14:03 UTC
svn commit: r525500 - in /lucene/hadoop/trunk: CHANGES.txt
src/java/org/apache/hadoop/mapred/TaskTracker.java
Author: tomwhite
Date: Wed Apr 4 05:14:03 2007
New Revision: 525500
URL: http://svn.apache.org/viewvc?view=rev&rev=525500
Log:
HADOOP-1179. Make Task Tracker close index file as soon as the read is done when serving get-map-output requests.
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=525500&r1=525499&r2=525500
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Apr 4 05:14:03 2007
@@ -123,6 +123,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/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=525500&r1=525499&r2=525500
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Wed Apr 4 05:14:03 2007
@@ -1649,6 +1649,9 @@
long startOffset = indexIn.readLong();
long partLength = indexIn.readLong();
+ indexIn.close();
+ indexIn = null;
+
//set the content-length header
response.setContentLength((int) partLength);
@@ -1660,31 +1663,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 =
@@ -1699,7 +1694,14 @@
}
response.sendError(HttpServletResponse.SC_GONE, errorMsg);
throw ie;
- }
+ } finally {
+ if (indexIn != null) {
+ indexIn.close();
+ }
+ if (mapOutputIn != null) {
+ mapOutputIn.close();
+ }
+ }
outStream.close();
}
}