HDFS-13554. TestDatanodeRegistration#testForcedRegistration does not shut down cluster. Contributed by Anbang Hu.
This commit is contained in:
parent
d45a0b7d73
commit
65476458fa
|
@ -330,8 +330,9 @@ public class TestDatanodeRegistration {
|
||||||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_HANDLER_COUNT_KEY, 4);
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_HANDLER_COUNT_KEY, 4);
|
||||||
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, Integer.MAX_VALUE);
|
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, Integer.MAX_VALUE);
|
||||||
|
|
||||||
final MiniDFSCluster cluster =
|
MiniDFSCluster cluster = null;
|
||||||
new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
try {
|
||||||
|
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
||||||
cluster.waitActive();
|
cluster.waitActive();
|
||||||
cluster.getHttpUri(0);
|
cluster.getHttpUri(0);
|
||||||
FSNamesystem fsn = cluster.getNamesystem();
|
FSNamesystem fsn = cluster.getNamesystem();
|
||||||
|
@ -366,14 +367,15 @@ public class TestDatanodeRegistration {
|
||||||
assertTrue(dnd.isRegistered());
|
assertTrue(dnd.isRegistered());
|
||||||
assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
||||||
|
|
||||||
// check that block report is not processed and registration didn't change.
|
// check that block report is not processed and registration didn't
|
||||||
|
// change.
|
||||||
dnd.setForceRegistration(true);
|
dnd.setForceRegistration(true);
|
||||||
assertFalse(waitForBlockReport(dn, dnd));
|
assertFalse(waitForBlockReport(dn, dnd));
|
||||||
assertFalse(dnd.isRegistered());
|
assertFalse(dnd.isRegistered());
|
||||||
assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
||||||
|
|
||||||
// heartbeat should trigger re-registration, and next block report should
|
// heartbeat should trigger re-registration, and next block report
|
||||||
// not change registration.
|
// should not change registration.
|
||||||
waitForHeartbeat(dn, dnd);
|
waitForHeartbeat(dn, dnd);
|
||||||
assertTrue(dnd.isRegistered());
|
assertTrue(dnd.isRegistered());
|
||||||
newReg = dn.getDNRegistrationForBP(bpId);
|
newReg = dn.getDNRegistrationForBP(bpId);
|
||||||
|
@ -410,6 +412,11 @@ public class TestDatanodeRegistration {
|
||||||
waitForHeartbeat(dn, dnd);
|
waitForHeartbeat(dn, dnd);
|
||||||
assertTrue(dnd.isRegistered());
|
assertTrue(dnd.isRegistered());
|
||||||
assertNotSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
assertNotSame(lastReg, dn.getDNRegistrationForBP(bpId));
|
||||||
|
} finally {
|
||||||
|
if (cluster != null) {
|
||||||
|
cluster.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForHeartbeat(final DataNode dn, final DatanodeDescriptor dnd)
|
private void waitForHeartbeat(final DataNode dn, final DatanodeDescriptor dnd)
|
||||||
|
|
Loading…
Reference in New Issue