HDFS-1692. In secure mode, Datanode process doesn't exit when disks fail. Contributed by Bharath Mundlapudi.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1136741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2011-06-16 23:35:11 +00:00
parent 9185f8b003
commit 58dc1381e0
4 changed files with 18 additions and 8 deletions

View File

@ -751,6 +751,9 @@ Trunk (unreleased changes)
HDFS-1656. Fixes an issue to do with fetching of delegation tokens in HDFS-1656. Fixes an issue to do with fetching of delegation tokens in
HftpFileSystem. Contributed by Kan Zhang. 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 Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -2280,6 +2280,13 @@ public class DataNode extends Configured
} catch (Throwable e) { } catch (Throwable e) {
LOG.error(StringUtils.stringifyException(e)); LOG.error(StringUtils.stringifyException(e));
System.exit(-1); 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);
} }
} }

View File

@ -47,7 +47,7 @@ class DataXceiverServer implements Runnable, FSConstants {
ServerSocket ss; ServerSocket ss;
DataNode datanode; DataNode datanode;
// Record all sockets opend for data transfer // Record all sockets opened for data transfer
Map<Socket, Socket> childSockets = Collections.synchronizedMap( Map<Socket, Socket> childSockets = Collections.synchronizedMap(
new HashMap<Socket, Socket>()); new HashMap<Socket, Socket>());
@ -140,19 +140,18 @@ class DataXceiverServer implements Runnable, FSConstants {
} catch (SocketTimeoutException ignored) { } catch (SocketTimeoutException ignored) {
// wake up to see if should continue to run // wake up to see if should continue to run
} catch (IOException ie) { } catch (IOException ie) {
LOG.warn(datanode.getMachineName() + ":DataXceiveServer: " LOG.warn(datanode.getMachineName() + ":DataXceiveServer: ", ie);
+ StringUtils.stringifyException(ie));
} catch (Throwable te) { } catch (Throwable te) {
LOG.error(datanode.getMachineName() + ":DataXceiveServer: Exiting due to:" LOG.error(datanode.getMachineName()
+ StringUtils.stringifyException(te)); + ":DataXceiveServer: Exiting due to: ", te);
datanode.shouldRun = false; datanode.shouldRun = false;
} }
} }
try { try {
ss.close(); ss.close();
} catch (IOException ie) { } catch (IOException ie) {
LOG.warn(datanode.getMachineName() + ":DataXceiveServer: " LOG.warn(datanode.getMachineName()
+ StringUtils.stringifyException(ie)); + ":DataXceiveServer: Close exception due to: ", ie);
} }
} }

View File

@ -879,7 +879,8 @@ public class FSDataset implements FSConstants, FSDatasetInterface {
if (removedVols == null) { if (removedVols == null) {
removedVols = new ArrayList<FSVolume>(1); removedVols = new ArrayList<FSVolume>(1);
} }
removedVols.add(volumeList.get(idx)); removedVols.add(fsv);
fsv.shutdown();
volumeList.set(idx, null); // Remove the volume volumeList.set(idx, null); // Remove the volume
numFailedVolumes++; numFailedVolumes++;
} }