From d4c9201fc2e68fa52387b4e3c55d014eac77837e Mon Sep 17 00:00:00 2001 From: ryakhovskiy Date: Fri, 4 Aug 2023 09:30:02 +0200 Subject: [PATCH 1/2] add test case for hbase-27995 --- .../org/apache/hadoop/hbase/io/hfile/TestHFile.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java index e33708022203..6900429ee1af 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java @@ -1019,6 +1019,15 @@ public void testReaderWithLruCombinedBlockCache() throws Exception { testReaderCombinedCache("LRU"); } + /** + * HBASE-27995 + */ + @Test + public void testReaderWithAdaptiveLruCombinedBlockCacheWithHardCapacityLimit() throws Exception { + conf.setDouble(LruAdaptiveBlockCache.LRU_HARD_CAPACITY_LIMIT_FACTOR_CONFIG_NAME, -0.4921875); + testReaderWithAdaptiveLruCombinedBlockCache(); + } + private void testReaderCombinedCache(final String l1CachePolicy) throws Exception { int bufCount = 1024; int blockSize = 64 * 1024; @@ -1049,7 +1058,9 @@ private void testReaderCombinedCache(final String l1CachePolicy) throws Exceptio Assert.assertFalse(hfb.isSharedMem()); } } finally { - cachedBlock.release(); + if (null != cachedBlock) { + cachedBlock.release(); + } } block.release(); // return back the ByteBuffer back to allocator. } From caebb7e0fdf4604b026629b17a5ac87687f0b424 Mon Sep 17 00:00:00 2001 From: ryakhovskiy Date: Fri, 4 Aug 2023 10:19:58 +0200 Subject: [PATCH 2/2] add text to the comment --- .../test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java index 6900429ee1af..e309cb000352 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java @@ -1020,7 +1020,7 @@ public void testReaderWithLruCombinedBlockCache() throws Exception { } /** - * HBASE-27995 + * Tet case for HBASE-27995 */ @Test public void testReaderWithAdaptiveLruCombinedBlockCacheWithHardCapacityLimit() throws Exception {