You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2021/03/16 14:56:16 UTC

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

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

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


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

commit f5b2d6b18920dd39937541334f07ce5396ea5049
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 f8b724c..381c114 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
@@ -577,7 +577,7 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
    * Multi-threaded call to run the eviction process.
    */
   private void runEviction() {
-    if (evictionThread == null) {
+    if (evictionThread == null || !evictionThread.isGo()) {
       evict();
     } else {
       evictionThread.evict();
@@ -888,7 +888,10 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
           }
         }
         LruBlockCache cache = this.cache.get();
-        if (cache == null) break;
+        if (cache == null) {
+          this.go = false;
+          break;
+        }
         cache.evict();
       }
     }
@@ -906,6 +909,10 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
       this.notifyAll();
     }
 
+    public boolean isGo() {
+      return go;
+    }
+
     /**
      * Used for the test.
      */