From 85f9f95a8ffb57bcdf360e89451547b388c48e15 Mon Sep 17 00:00:00 2001 From: huaxiangsun <62515050+huaxiangsun@users.noreply.github.com> Date: Thu, 26 Mar 2020 14:06:34 -0700 Subject: [PATCH] HBASE-23853 [Flakey Test] TestBlockEvictionFromClient#testBlockRefCountAfterSplits (#1363) Signed-off-by: Jan Hentschel Signed-off-by: Viraj Jasani Signed-off-by: --- .../hbase/client/TestBlockEvictionFromClient.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java index 3d4355791b44..dbf0ce86d8f7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java @@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionLocation; +import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; @@ -51,6 +52,7 @@ import org.apache.hadoop.hbase.io.hfile.CachedBlock; import org.apache.hadoop.hbase.io.hfile.CombinedBlockCache; import org.apache.hadoop.hbase.io.hfile.bucket.BucketCache; +import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.HStore; import org.apache.hadoop.hbase.regionserver.InternalScanner; @@ -573,7 +575,14 @@ public void testBlockRefCountAfterSplits() throws IOException, InterruptedExcept Table table = null; try { final TableName tableName = TableName.valueOf(name.getMethodName()); - table = TEST_UTIL.createTable(tableName, FAMILIES_1, 1, 1024); + HTableDescriptor desc = TEST_UTIL.createTableDescriptor(tableName); + // This test expects rpc refcount of cached data blocks to be 0 after split. After split, + // two daughter regions are opened and a compaction is scheduled to get rid of reference + // of the parent region hfiles. Compaction will increase refcount of cached data blocks by 1. + // It is flakey since compaction can kick in anytime. To solve this issue, table is created + // with compaction disabled. + desc.setCompactionEnabled(false); + table = TEST_UTIL.createTable(desc, FAMILIES_1, null, BloomType.ROW, 1024, null); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName();