Author: rangadi
Date: Thu Jan 29 01:29:50 2009
New Revision: 738700
URL: http://svn.apache.org/viewvc?rev=738700&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.19/ (props changed)
hadoop/core/branches/branch-0.19/CHANGES.txt (contents, props changed)
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
Propchange: hadoop/core/branches/branch-0.19/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 29 01:29:50 2009
@@ -1 +1 @@
-/hadoop/core/trunk:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,709040,709303,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,736426
+/hadoop/core/trunk:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,709040,709303,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,736426,738697
Modified: hadoop/core/branches/branch-0.19/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/CHANGES.txt?rev=738700&r1=738699&r2=738700&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.19/CHANGES.txt Thu Jan 29 01:29:50 2009
@@ -74,6 +74,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.19/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 29 01:29:50 2009
@@ -1,2 +1,2 @@
/hadoop/core/branches/branch-0.18/CHANGES.txt:727226
-/hadoop/core/trunk/CHANGES.txt:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,708723,709040,709303,711717,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,735082,736426
+/hadoop/core/trunk/CHANGES.txt:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,708723,709040,709303,711717,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,735082,736426,738697
Modified:
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
URL:
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java?rev=738700&r1=738699&r2=738700&view=diff
==============================================================================
---
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
(original)
+++
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
Thu Jan 29 01:29:50 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));