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

This commit is contained in:
Yongjun Zhang 2015-10-09 09:21:29 -07:00
parent 4aa9b3e75c
commit c11fc8a1be
3 changed files with 9 additions and 5 deletions

View File

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

View File

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

View File

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