hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/2] hbase git commit: HBASE-19138 Rare failure in TestLruBlockCache
Date Tue, 31 Oct 2017 20:40:42 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 d099263e1 -> 0ac5b3374
  refs/heads/branch-1.4 7390763da -> 5af2c1a3a


HBASE-19138 Rare failure in TestLruBlockCache

Wait for the block count to drop to zero after awaiting shutdown of the executor pool


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5af2c1a3
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5af2c1a3
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5af2c1a3

Branch: refs/heads/branch-1.4
Commit: 5af2c1a3aea69a7a9a9b061f5cc6297918894aa5
Parents: 7390763
Author: Andrew Purtell <apurtell@apache.org>
Authored: Tue Oct 31 11:35:48 2017 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Tue Oct 31 11:35:48 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/io/hfile/TestLruBlockCache.java    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5af2c1a3/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
index 305e16c..92408f8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
@@ -31,6 +31,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.Waiter;
+import org.apache.hadoop.hbase.Waiter.ExplainingPredicate;
 import org.apache.hadoop.hbase.io.HeapSize;
 import org.apache.hadoop.hbase.io.hfile.LruBlockCache.EvictionThread;
 import org.apache.hadoop.hbase.util.ClassSize;
@@ -55,6 +59,7 @@ public class TestLruBlockCache {
     final long blockSize = calculateBlockSizeDefault(maxSize, numBlocks);
     assertTrue("calculateBlockSize appears broken.", blockSize * numBlocks <= maxSize);
 
+    final Configuration conf = HBaseConfiguration.create();
     final LruBlockCache cache = new LruBlockCache(maxSize, blockSize);
     EvictionThread evictionThread = cache.getEvictionThread();
     assertTrue(evictionThread != null);
@@ -83,6 +88,17 @@ public class TestLruBlockCache {
       service.shutdown();
       // The test may fail here if the evict thread frees the blocks too fast
       service.awaitTermination(10, TimeUnit.MINUTES);
+      Waiter.waitFor(conf, 10000, 100, new ExplainingPredicate<Exception>() {
+        @Override
+        public boolean evaluate() throws Exception {
+          return cache.getBlockCount() == 0;
+        }
+
+        @Override
+        public String explainFailure() throws Exception {
+          return "Cache block count failed to return to 0";
+        }
+      });
       assertEquals(0, cache.getBlockCount());
       assertEquals(cache.getOverhead(), cache.getCurrentSize());
     }


Mime
View raw message