HDFS-7533. Datanode sometimes does not shutdown on receiving upgrade shutdown command. Contributed by Eric Payne.
(cherry picked from commit6bbf9fdd04
) (cherry picked from commit33534a0c9a
) (cherry picked from commit e9a28251ee46e64e1b99b2dd54b0432bdc0b9578)
This commit is contained in:
parent
8382e52c94
commit
ae288f7291
|
@ -61,6 +61,9 @@ Release 2.6.1 - UNRELEASED
|
|||
HDFS-7225. Remove stale block invalidation work when DN re-registers with
|
||||
different UUID. (Zhe Zhang and Andrew Wang)
|
||||
|
||||
HDFS-7533. Datanode sometimes does not shutdown on receiving upgrade
|
||||
shutdown command (Eric Payne via kihwal)
|
||||
|
||||
Release 2.6.0 - 2014-11-18
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -1627,9 +1627,13 @@ public class DataNode extends ReconfigurableBase
|
|||
// in order to avoid any further acceptance of requests, but the peers
|
||||
// for block writes are not closed until the clients are notified.
|
||||
if (dataXceiverServer != null) {
|
||||
xserver.sendOOBToPeers();
|
||||
((DataXceiverServer) this.dataXceiverServer.getRunnable()).kill();
|
||||
this.dataXceiverServer.interrupt();
|
||||
try {
|
||||
xserver.sendOOBToPeers();
|
||||
((DataXceiverServer) this.dataXceiverServer.getRunnable()).kill();
|
||||
this.dataXceiverServer.interrupt();
|
||||
} catch (Throwable e) {
|
||||
// Ignore, since the out of band messaging is advisory.
|
||||
}
|
||||
}
|
||||
|
||||
// Interrupt the checkDiskErrorThread and terminate it.
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.hdfs.server.datanode;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -32,6 +33,7 @@ import org.apache.hadoop.hdfs.MiniDFSNNTopology;
|
|||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
/**
|
||||
* Tests if DataNode process exits if all Block Pool services exit.
|
||||
|
@ -88,4 +90,18 @@ public class TestDataNodeExit {
|
|||
stopBPServiceThreads(2, dn);
|
||||
assertFalse("DataNode should exit", dn.isDatanodeUp());
|
||||
}
|
||||
|
||||
@Test
|
||||
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();
|
||||
dn.xserver = spyXserver;
|
||||
try {
|
||||
dn.shutdown();
|
||||
} catch (Throwable t) {
|
||||
fail("DataNode shutdown should not have thrown exception " + t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue