Author: rangadi
Date: Thu Jan 29 01:28:36 2009
New Revision: 738698
URL: http://svn.apache.org/viewvc?rev=738698&view=rev
Log:
HADOOP-4862. Minor : HADOOP-3678 did not remove all the cases of
spurious IOExceptions logged by DataNode. (Raghu Angadi)
Modified:
hadoop/core/branches/branch-0.20/ (props changed)
hadoop/core/branches/branch-0.20/CHANGES.txt (contents, props changed)
hadoop/core/branches/branch-0.20/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
Propchange: hadoop/core/branches/branch-0.20/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 29 01:28:36 2009
@@ -1,2 +1,2 @@
/hadoop/core/branches/branch-0.19:713112
-/hadoop/core/trunk:727001,727117,727191,727212,727217,727228,727255,727869,728187,729052,729987,732385,732572,732777,732838,732869,733887,734870,734916,736426,738328
+/hadoop/core/trunk:727001,727117,727191,727212,727217,727228,727255,727869,728187,729052,729987,732385,732572,732777,732838,732869,733887,734870,734916,736426,738328,738697
Modified: hadoop/core/branches/branch-0.20/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/CHANGES.txt?rev=738698&r1=738697&r2=738698&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.20/CHANGES.txt Thu Jan 29 01:28:36 2009
@@ -644,6 +644,9 @@
HADOOP-4955. Make DBOutputFormat us column names from setOutput().
(Kevin Peterson via enis)
+ HADOOP-4862. Minor : HADOOP-3678 did not remove all the cases of
+ spurious IOExceptions logged by DataNode. (Raghu Angadi)
+
Release 0.19.0 - 2008-11-18
INCOMPATIBLE CHANGES
Propchange: hadoop/core/branches/branch-0.20/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 29 01:28:36 2009
@@ -1,3 +1,3 @@
/hadoop/core/branches/branch-0.18/CHANGES.txt:727226
/hadoop/core/branches/branch-0.19/CHANGES.txt:713112
-/hadoop/core/trunk/CHANGES.txt:727001,727117,727191,727212,727228,727255,727869,728187,729052,729987,732385,732572,732777,732838,732869,733887,734870,734916,735082,736426,738602
+/hadoop/core/trunk/CHANGES.txt:727001,727117,727191,727212,727228,727255,727869,728187,729052,729987,732385,732572,732777,732838,732869,733887,734870,734916,735082,736426,738602,738697
Modified:
hadoop/core/branches/branch-0.20/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
URL:
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java?rev=738698&r1=738697&r2=738698&view=diff
==============================================================================
---
hadoop/core/branches/branch-0.20/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
(original)
+++
hadoop/core/branches/branch-0.20/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
Thu Jan 29 01:28:36 2009
@@ -201,6 +201,26 @@
}
/**
+ * Converts an IOExcpetion (not subclasses) to SocketException.
+ * This is typically done to indicate to upper layers that the error
+ * was a socket error rather than often more serious exceptions like
+ * disk errors.
+ */
+ private static IOException ioeToSocketException(IOException ioe) {
+ if (ioe.getClass().equals(IOException.class)) {
+ // "se" could be a new class in stead of SocketException.
+ IOException se = new SocketException("Original Exception : " + ioe);
+ se.initCause(ioe);
+ /* Change the stacktrace so that original trace is not truncated
+ * when printed.*/
+ se.setStackTrace(ioe.getStackTrace());
+ return se;
+ }
+ // otherwise just return the same exception.
+ return ioe;
+ }
+
+ /**
* Sends upto maxChunks chunks of data.
*
* When blockInPosition is >= 0, assumes 'out' is a
@@ -301,20 +321,9 @@
} 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.
+ * it could also be while reading from the local file).
*/
- 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;
+ throw ioeToSocketException(e);
}
if (throttler != null) { // rebalancing so throttle
@@ -349,11 +358,15 @@
OutputStream streamForSendChunks = out;
try {
- checksum.writeHeader(out);
- if ( chunkOffsetOK ) {
- out.writeLong( offset );
+ try {
+ checksum.writeHeader(out);
+ if ( chunkOffsetOK ) {
+ out.writeLong( offset );
+ }
+ out.flush();
+ } catch (IOException e) { //socket error
+ throw ioeToSocketException(e);
}
- out.flush();
int maxChunksPerPacket;
int pktSize = DataNode.PKT_HEADER_LEN + SIZE_OF_INTEGER;
@@ -391,8 +404,12 @@
checksumSize);
seqno++;
}
- out.writeInt(0); // mark the end of block
- out.flush();
+ try {
+ out.writeInt(0); // mark the end of block
+ out.flush();
+ } catch (IOException e) { //socket error
+ throw ioeToSocketException(e);
+ }
} finally {
if (clientTraceFmt != null) {
ClientTraceLog.info(String.format(clientTraceFmt, totalRead));