HBASE-25595 TestLruBlockCache.testBackgroundEvictionThread is flaky (#2974)

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
haxiaolin 2021-03-16 05:25:38 +08:00 committed by GitHub
parent 21409bf4d6
commit 625bea3ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -628,7 +628,7 @@ public class LruBlockCache implements FirstLevelBlockCache {
* Multi-threaded call to run the eviction process.
*/
private void runEviction() {
if (evictionThread == null) {
if (evictionThread == null || !evictionThread.isGo()) {
evict();
} else {
evictionThread.evict();
@ -942,6 +942,7 @@ public class LruBlockCache implements FirstLevelBlockCache {
}
LruBlockCache cache = this.cache.get();
if (cache == null) {
this.go = false;
break;
}
cache.evict();
@ -961,6 +962,10 @@ public class LruBlockCache implements FirstLevelBlockCache {
this.notifyAll();
}
public boolean isGo() {
return go;
}
/**
* Used for the test.
*/