diff --git a/hdfs/CHANGES.txt b/hdfs/CHANGES.txt index 8855c3bded..76493495c0 100644 --- a/hdfs/CHANGES.txt +++ b/hdfs/CHANGES.txt @@ -751,6 +751,9 @@ Trunk (unreleased changes) HDFS-1656. Fixes an issue to do with fetching of delegation tokens in HftpFileSystem. Contributed by Kan Zhang. + HDFS-1692. In secure mode, Datanode process doesn't exit when disks + fail. (Bharath Mundlapudi via suresh) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java index 738d12b0cd..816ab24a9c 100644 --- a/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java +++ b/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java @@ -2280,6 +2280,13 @@ public class DataNode extends Configured } catch (Throwable e) { LOG.error(StringUtils.stringifyException(e)); System.exit(-1); + } finally { + // We need to add System.exit here because either shutdown was called or + // some disk related conditions like volumes tolerated or volumes required + // condition was not met. Also, In secure mode, control will go to Jsvc + // and Datanode process hangs without System.exit. + LOG.warn("Exiting Datanode"); + System.exit(0); } } diff --git a/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java b/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java index 06c495e48b..841062d715 100644 --- a/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java +++ b/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java @@ -47,7 +47,7 @@ class DataXceiverServer implements Runnable, FSConstants { ServerSocket ss; DataNode datanode; - // Record all sockets opend for data transfer + // Record all sockets opened for data transfer Map childSockets = Collections.synchronizedMap( new HashMap()); @@ -140,19 +140,18 @@ class DataXceiverServer implements Runnable, FSConstants { } catch (SocketTimeoutException ignored) { // wake up to see if should continue to run } catch (IOException ie) { - LOG.warn(datanode.getMachineName() + ":DataXceiveServer: " - + StringUtils.stringifyException(ie)); + LOG.warn(datanode.getMachineName() + ":DataXceiveServer: ", ie); } catch (Throwable te) { - LOG.error(datanode.getMachineName() + ":DataXceiveServer: Exiting due to:" - + StringUtils.stringifyException(te)); + LOG.error(datanode.getMachineName() + + ":DataXceiveServer: Exiting due to: ", te); datanode.shouldRun = false; } } try { ss.close(); } catch (IOException ie) { - LOG.warn(datanode.getMachineName() + ":DataXceiveServer: " - + StringUtils.stringifyException(ie)); + LOG.warn(datanode.getMachineName() + + ":DataXceiveServer: Close exception due to: ", ie); } } diff --git a/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java b/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java index b73fac01b3..85c689abb7 100644 --- a/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java +++ b/hdfs/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java @@ -879,7 +879,8 @@ public class FSDataset implements FSConstants, FSDatasetInterface { if (removedVols == null) { removedVols = new ArrayList(1); } - removedVols.add(volumeList.get(idx)); + removedVols.add(fsv); + fsv.shutdown(); volumeList.set(idx, null); // Remove the volume numFailedVolumes++; }