HDFS-15126. TestDatanodeRegistration#testForcedRegistration fails intermittently. Contributed by Ahmed Hussein.

This commit is contained in:
Inigo Goiri 2020-01-21 13:22:53 -08:00
parent f206b736f0
commit b657822b98
1 changed files with 8 additions and 4 deletions

View File

@ -364,14 +364,16 @@ public class TestDatanodeRegistration {
waitForHeartbeat(dn, dnd); waitForHeartbeat(dn, dnd);
assertTrue(dnd.isRegistered()); assertTrue(dnd.isRegistered());
assertSame(lastReg, dn.getDNRegistrationForBP(bpId)); assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
assertTrue(waitForBlockReport(dn, dnd)); assertTrue("block report is not processed for DN " + dnd,
waitForBlockReport(dn, dnd));
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 // check that block report is not processed and registration didn't
// change. // change.
dnd.setForceRegistration(true); dnd.setForceRegistration(true);
assertFalse(waitForBlockReport(dn, dnd)); assertFalse("block report is processed for DN " + dnd,
waitForBlockReport(dn, dnd));
assertFalse(dnd.isRegistered()); assertFalse(dnd.isRegistered());
assertSame(lastReg, dn.getDNRegistrationForBP(bpId)); assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
@ -382,7 +384,8 @@ public class TestDatanodeRegistration {
newReg = dn.getDNRegistrationForBP(bpId); newReg = dn.getDNRegistrationForBP(bpId);
assertNotSame(lastReg, newReg); assertNotSame(lastReg, newReg);
lastReg = newReg; lastReg = newReg;
assertTrue(waitForBlockReport(dn, dnd)); assertTrue("block report is not processed for DN " + dnd,
waitForBlockReport(dn, dnd));
assertTrue(dnd.isRegistered()); assertTrue(dnd.isRegistered());
assertSame(lastReg, dn.getDNRegistrationForBP(bpId)); assertSame(lastReg, dn.getDNRegistrationForBP(bpId));
@ -447,8 +450,9 @@ public class TestDatanodeRegistration {
public Boolean get() { public Boolean get() {
return lastCount != storage.getBlockReportCount(); return lastCount != storage.getBlockReportCount();
} }
}, 10, 2000); }, 10, 6000);
} catch (TimeoutException te) { } catch (TimeoutException te) {
LOG.error("Timeout waiting for block report for {}", dnd);
return false; return false;
} }
return true; return true;