You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2021/03/15 21:28:33 UTC

[hbase] branch branch-2.3 updated: HBASE-25595 TestLruBlockCache.testBackgroundEvictionThread is flaky (#2974)

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new d71e0ec  HBASE-25595 TestLruBlockCache.testBackgroundEvictionThread is flaky (#2974)
d71e0ec is described below

commit d71e0ecdb5a7494e09721cc2e013ec7762c675a9
Author: haxiaolin <li...@gmail.com>
AuthorDate: Tue Mar 16 05:25:38 2021 +0800

    HBASE-25595 TestLruBlockCache.testBackgroundEvictionThread is flaky (#2974)
    
    Signed-off-by: stack <st...@apache.org>
---
 .../java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
index 5587c40..031039a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
@@ -634,7 +634,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();
@@ -945,7 +945,10 @@ public class LruBlockCache implements FirstLevelBlockCache {
           }
         }
         LruBlockCache cache = this.cache.get();
-        if (cache == null) break;
+        if (cache == null) {
+          this.go = false;
+          break;
+        }
         cache.evict();
       }
     }
@@ -963,6 +966,10 @@ public class LruBlockCache implements FirstLevelBlockCache {
       this.notifyAll();
     }
 
+    public boolean isGo() {
+      return go;
+    }
+
     /**
      * Used for the test.
      */