HDFS-9181. Better handling of exceptions thrown during upgrade shutdown. Contributed by Wei-Chiu Chuang.

(cherry picked from commit c11fc8a1be)
This commit is contained in:
Yongjun Zhang 2015-10-09 09:21:29 -07:00
parent 2d8f9e3fd9
commit 61988f8016
3 changed files with 9 additions and 5 deletions

View File

@ -676,6 +676,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8164. cTime is 0 in VERSION file for newly formatted NameNode.
(Xiao Chen via Yongjun Zhang)
HDFS-9181. Better handling of exceptions thrown during upgrade shutdown.
(Wei-Chiu Chuang via Yongjun Zhang)
OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -1765,8 +1765,9 @@ public class DataNode extends ReconfigurableBase
xserver.sendOOBToPeers();
((DataXceiverServer) this.dataXceiverServer.getRunnable()).kill();
this.dataXceiverServer.interrupt();
} catch (Throwable e) {
} catch (Exception e) {
// Ignore, since the out of band messaging is advisory.
LOG.trace("Exception interrupting DataXceiverServer: ", e);
}
}

View File

@ -96,13 +96,13 @@ public class TestDataNodeExit {
public void testSendOOBToPeers() throws Exception {
DataNode dn = cluster.getDataNodes().get(0);
DataXceiverServer spyXserver = Mockito.spy(dn.getXferServer());
NullPointerException e = new NullPointerException();
Mockito.doThrow(e).when(spyXserver).sendOOBToPeers();
NullPointerException npe = new NullPointerException();
Mockito.doThrow(npe).when(spyXserver).sendOOBToPeers();
dn.xserver = spyXserver;
try {
dn.shutdown();
} catch (Throwable t) {
fail("DataNode shutdown should not have thrown exception " + t);
} catch (Exception e) {
fail("DataNode shutdown should not have thrown exception " + e);
}
}
}