Author: rangadi
Date: Thu Jul 17 17:05:00 2008
New Revision: 677779
URL: http://svn.apache.org/viewvc?rev=677779&view=rev
Log:
HADOOP-3678. Avoid spurious exceptions logged at DataNode when clients
read from DFS. (rangadi)
Modified:
hadoop/core/branches/branch-0.17/CHANGES.txt
hadoop/core/branches/branch-0.17/src/java/org/apache/hadoop/dfs/DataNode.java
Modified: hadoop/core/branches/branch-0.17/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.17/CHANGES.txt?rev=677779&r1=677778&r2=677779&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.17/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.17/CHANGES.txt Thu Jul 17 17:05:00 2008
@@ -4,6 +4,9 @@
BUG FIXES
+ HADOOP-3678. Avoid spurious exceptions logged at DataNode when clients
+ read from DFS. (rangadi)
+
HADOOP-3760. Fix a bug with HDFS file close() mistakenly introduced
by HADOOP-3681. (Lohit Vijayarenu via rangadi)
Modified:
hadoop/core/branches/branch-0.17/src/java/org/apache/hadoop/dfs/DataNode.java
URL:
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.17/src/java/org/apache/hadoop/dfs/DataNode.java?rev=677779&r1=677778&r2=677779&view=diff
==============================================================================
---
hadoop/core/branches/branch-0.17/src/java/org/apache/hadoop/dfs/DataNode.java
(original)
+++
hadoop/core/branches/branch-0.17/src/java/org/apache/hadoop/dfs/DataNode.java
Thu Jul 17 17:05:00 2008
@@ -1780,7 +1780,25 @@
}
}
- out.write(buf, 0, dataOff + len);
+ try {
+ out.write(buf, 0, dataOff + len);
+ } catch (IOException e) {
+ /* exception while writing to the client (well, with transferTo(),
+ * it could also be while reading from the local file). Many times
+ * this error can be ignored. We will let the callers distinguish this
+ * from other exceptions if this is not a subclass of IOException.
+ */
+ if (e.getClass().equals(IOException.class)) {
+ // "se" could be a new class in stead of SocketException.
+ IOException se = new SocketException("Original Exception : " + e);
+ se.initCause(e);
+ /* Cange the stacktrace so that original trace is not truncated
+ * when printed.*/
+ se.setStackTrace(e.getStackTrace());
+ throw se;
+ }
+ throw e;
+ }
if (throttler != null) { // rebalancing so throttle
throttler.throttle(packetLen);