HDFS-9176. Fix TestDirectoryScanner#testThrottling often fails. (Daniel Templeton via lei)
This commit is contained in:
parent
7fbf69bf47
commit
6dd47d754c
|
@ -1974,6 +1974,9 @@ Release 2.8.0 - UNRELEASED
|
|||
HDFS-9159. [OIV] : return value of the command is not correct if invalid
|
||||
value specified in "-p (processor)" option (nijel via vinayakumarb)
|
||||
|
||||
HDFS-9176. Fix TestDirectoryScanner#testThrottling often fails.
|
||||
(Daniel Templeton via lei)
|
||||
|
||||
Release 2.7.2 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -665,17 +665,24 @@ public class TestDirectoryScanner {
|
|||
interruptor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
scanner.shutdown();
|
||||
nowMs.set(Time.monotonicNow());
|
||||
scanner.shutdown();
|
||||
}
|
||||
}, 2L, TimeUnit.SECONDS);
|
||||
|
||||
scanner.reconcile();
|
||||
assertFalse(scanner.getRunStatus());
|
||||
LOG.info("Scanner took " + (Time.monotonicNow() - nowMs.get())
|
||||
+ "ms to shutdown");
|
||||
assertTrue("Scanner took too long to shutdown",
|
||||
Time.monotonicNow() - nowMs.get() < 1000L);
|
||||
|
||||
long finalMs = nowMs.get();
|
||||
|
||||
// If the scan didn't complete before the shutdown was run, check
|
||||
// that the shutdown was timely
|
||||
if (finalMs > 0) {
|
||||
LOG.info("Scanner took " + (Time.monotonicNow() - finalMs)
|
||||
+ "ms to shutdown");
|
||||
assertTrue("Scanner took too long to shutdown",
|
||||
Time.monotonicNow() - finalMs < 1000L);
|
||||
}
|
||||
|
||||
ratio =
|
||||
(float)scanner.timeWaitingMs.get() / scanner.timeRunningMs.get();
|
||||
|
|
Loading…
Reference in New Issue