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 cu...@apache.org on 2006/03/14 20:03:10 UTC
svn commit: r385856 - in
/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred: MapOutputFile.java
TaskTracker.java
Author: cutting
Date: Tue Mar 14 11:03:09 2006
New Revision: 385856
URL: http://svn.apache.org/viewcvs?rev=385856&view=rev
Log:
Fix tasktracker to exit when errors are encountered reading map output, in order to force re-execution of map tasks. It's overkill, since it will re-compute all map output computed by that task tracker, not just that which could not be read, but this should be a rare situation. If we start seeing it frequently, then we could optimize this by adding a way to tell the jobtracker that a particular previously completed map task now needs to be re-executed.
Modified:
lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapOutputFile.java
lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapOutputFile.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapOutputFile.java?rev=385856&r1=385855&r2=385856&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapOutputFile.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapOutputFile.java Tue Mar 14 11:03:09 2006
@@ -17,6 +17,7 @@
package org.apache.hadoop.mapred;
import java.io.IOException;
+import java.util.logging.Level;
import java.io.*;
import org.apache.hadoop.io.*;
@@ -108,12 +109,28 @@
// write the length-prefixed file content to the wire
File file = getOutputFile(mapTaskId, partition);
out.writeLong(file.length());
- FSDataInputStream in = FileSystem.getNamed("local", this.jobConf).open(file);
+
+ FSDataInputStream in = null;
+ try {
+ in = FileSystem.getNamed("local", this.jobConf).open(file);
+ } catch (IOException e) {
+ // log a SEVERE exception in order to cause TaskTracker to exit
+ TaskTracker.LOG.log(Level.SEVERE, "Can't open map output:" + file, e);
+ throw e;
+ }
try {
byte[] buffer = new byte[8192];
- int l;
- while ((l = in.read(buffer)) != -1) {
+ int l = 0;
+
+ while (l != -1) {
out.write(buffer, 0, l);
+ try {
+ l = in.read(buffer);
+ } catch (IOException e) {
+ // log a SEVERE exception in order to cause TaskTracker to exit
+ TaskTracker.LOG.log(Level.SEVERE,"Can't read map output:" + file, e);
+ throw e;
+ }
}
} finally {
in.close();
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=385856&r1=385855&r2=385856&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Tue Mar 14 11:03:09 2006
@@ -305,6 +305,11 @@
}
}
lastHeartbeat = now;
+
+ if (LogFormatter.hasLoggedSevere()) {
+ LOG.info("Severe problem detected. TaskTracker exiting.");
+ return STALE_STATE;
+ }
}
return 0;