|
@@ -36,6 +36,7 @@ import java.net.SocketTimeoutException;
|
|
import java.net.URI;
|
|
import java.net.URI;
|
|
import java.net.UnknownHostException;
|
|
import java.net.UnknownHostException;
|
|
import java.nio.channels.ClosedByInterruptException;
|
|
import java.nio.channels.ClosedByInterruptException;
|
|
|
|
+import java.nio.channels.ClosedChannelException;
|
|
import java.nio.channels.SocketChannel;
|
|
import java.nio.channels.SocketChannel;
|
|
import java.security.PrivilegedExceptionAction;
|
|
import java.security.PrivilegedExceptionAction;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -51,7 +52,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
import javax.management.ObjectName;
|
|
import javax.management.ObjectName;
|
|
|
|
|
|
-
|
|
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
@@ -1325,12 +1325,7 @@ public class DataNode extends Configured
|
|
protected void checkDiskError(Exception e ) throws IOException {
|
|
protected void checkDiskError(Exception e ) throws IOException {
|
|
|
|
|
|
LOG.warn("checkDiskError: exception: ", e);
|
|
LOG.warn("checkDiskError: exception: ", e);
|
|
- if (e instanceof SocketException || e instanceof SocketTimeoutException
|
|
|
|
- || e instanceof ClosedByInterruptException
|
|
|
|
- || e.getMessage().startsWith("An established connection was aborted")
|
|
|
|
- || e.getMessage().startsWith("Broken pipe")
|
|
|
|
- || e.getMessage().startsWith("Connection reset")
|
|
|
|
- || e.getMessage().contains("java.nio.channels.SocketChannel")) {
|
|
|
|
|
|
+ if (isNetworkRelatedException(e)) {
|
|
LOG.info("Not checking disk as checkDiskError was called on a network" +
|
|
LOG.info("Not checking disk as checkDiskError was called on a network" +
|
|
" related exception");
|
|
" related exception");
|
|
return;
|
|
return;
|
|
@@ -1343,6 +1338,28 @@ public class DataNode extends Configured
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Check if the provided exception looks like it's from a network error
|
|
|
|
+ * @param e the exception from a checkDiskError call
|
|
|
|
+ * @return true if this exception is network related, false otherwise
|
|
|
|
+ */
|
|
|
|
+ protected boolean isNetworkRelatedException(Exception e) {
|
|
|
|
+ if (e instanceof SocketException
|
|
|
|
+ || e instanceof SocketTimeoutException
|
|
|
|
+ || e instanceof ClosedChannelException
|
|
|
|
+ || e instanceof ClosedByInterruptException) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String msg = e.getMessage();
|
|
|
|
+
|
|
|
|
+ return null != msg
|
|
|
|
+ && (msg.startsWith("An established connection was aborted")
|
|
|
|
+ || msg.startsWith("Broken pipe")
|
|
|
|
+ || msg.startsWith("Connection reset")
|
|
|
|
+ || msg.contains("java.nio.channels.SocketChannel"));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Check if there is a disk failure and if so, handle the error
|
|
* Check if there is a disk failure and if so, handle the error
|
|
*/
|
|
*/
|