|
@@ -924,6 +924,41 @@ public class TestDecommission {
|
|
|
cluster.shutdown();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Tests dead node count after restart of namenode
|
|
|
+ **/
|
|
|
+ @Test(timeout=360000)
|
|
|
+ public void testDeadNodeCountAfterNamenodeRestart()throws Exception {
|
|
|
+ LOG.info("Starting test testDeadNodeCountAfterNamenodeRestart");
|
|
|
+ int numNamenodes = 1;
|
|
|
+ int numDatanodes = 2;
|
|
|
+
|
|
|
+ startCluster(numNamenodes, numDatanodes, conf);
|
|
|
+
|
|
|
+ DFSClient client = getDfsClient(cluster.getNameNode(), conf);
|
|
|
+ DatanodeInfo[] info = client.datanodeReport(DatanodeReportType.LIVE);
|
|
|
+ DatanodeInfo excludedDatanode = info[0];
|
|
|
+ String excludedDatanodeName = info[0].getXferAddr();
|
|
|
+
|
|
|
+ writeConfigFile(hostsFile, new ArrayList<String>(Arrays.asList(
|
|
|
+ excludedDatanodeName, info[1].getXferAddr())));
|
|
|
+ decommissionNode(0, excludedDatanode.getDatanodeUuid(), null,
|
|
|
+ AdminStates.DECOMMISSIONED);
|
|
|
+
|
|
|
+ cluster.stopDataNode(excludedDatanodeName);
|
|
|
+ DFSTestUtil.waitForDatanodeState(
|
|
|
+ cluster, excludedDatanode.getDatanodeUuid(), false, 20000);
|
|
|
+
|
|
|
+ //Restart the namenode
|
|
|
+ cluster.restartNameNode();
|
|
|
+
|
|
|
+ assertEquals("There should be one node alive", 1,
|
|
|
+ client.datanodeReport(DatanodeReportType.LIVE).length);
|
|
|
+ assertEquals("There should be one node dead", 1,
|
|
|
+ client.datanodeReport(DatanodeReportType.DEAD).length);
|
|
|
+ cluster.shutdown();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Test using a "registration name" in a host include file.
|
|
|
*
|