HDFS-16426. Fix nextBlockReportTime when trigger full block report force (#3887)

(cherry picked from commit fcb1076699)
This commit is contained in:
qinyuren 2022-01-19 12:42:33 +08:00 committed by Takanobu Asanuma
parent 8ccc586af6
commit 1c71d6e9fe
2 changed files with 18 additions and 0 deletions

View File

@ -1215,6 +1215,7 @@ boolean isOutliersReportDue(long curTime) {
void forceFullBlockReportNow() {
forceFullBlockReport.set(true);
resetBlockReportTime = true;
}
/**

View File

@ -136,6 +136,23 @@ public void testScheduleNextBlockReport3() {
}
}
/**
* force trigger full block report multi times, the next block report
* must be scheduled in the range (now + BLOCK_REPORT_INTERVAL_SEC).
*/
@Test
public void testScheduleNextBlockReport4() {
for (final long now : getTimestamps()) {
Scheduler scheduler = makeMockScheduler(now);
for (int i = 0; i < getTimestamps().size(); ++i) {
scheduler.forceFullBlockReportNow();
scheduler.scheduleNextBlockReport();
}
assertTrue(scheduler.getNextBlockReportTime() - now >= 0);
assertTrue(scheduler.getNextBlockReportTime() - now <= BLOCK_REPORT_INTERVAL_MS);
}
}
@Test
public void testScheduleHeartbeat() {
for (final long now : getTimestamps()) {