You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/12/09 05:15:28 UTC

[GitHub] [hbase] anoopsjohn commented on a change in pull request #889: HBASE-23066 - Allow cache on write during compactions when prefetchin…

anoopsjohn commented on a change in pull request #889: HBASE-23066 - Allow cache on write during compactions when prefetchin…
URL: https://github.com/apache/hbase/pull/889#discussion_r355265137
 
 

 ##########
 File path: hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCacheOnWrite.java
 ##########
 @@ -448,16 +455,34 @@ private void testNotCachingDataBlocksDuringCompactionInternals(boolean useTags)
       }
       region.flush(true);
     }
+
     clearBlockCache(blockCache);
     assertEquals(0, blockCache.getBlockCount());
+
     region.compact(false);
     LOG.debug("compactStores() returned");
 
+    boolean dataBlockCached = false;
     for (CachedBlock block: blockCache) {
-      assertNotEquals(BlockType.ENCODED_DATA, block.getBlockType());
-      assertNotEquals(BlockType.DATA, block.getBlockType());
+      if (BlockType.ENCODED_DATA.equals(block.getBlockType())
+          || BlockType.DATA.equals(block.getBlockType())) {
+        dataBlockCached = true;
+        break;
+      }
     }
+
+    // Data blocks should be cached in instances where we are caching blocks on write. In the case
+    // of testing
+    // BucketCache, we cannot verify block type as it is not stored in the cache.
+    assertTrue(
+      "\nTest description: " + testDescription + "\nprefetchCompactedBlocksOnWrite: "
+          + cacheBlocksOnCompaction + "\n",
+      (cacheBlocksOnCompaction && !(blockCache instanceof BucketCache)) == dataBlockCached);
+
     region.close();
+
+    // Clear the cache on write setting
+    conf.setBoolean(CacheConfig.CACHE_COMPACTED_BLOCKS_ON_WRITE_KEY, false);
 
 Review comment:
   Minor : Get the existing conf value into a local var before setting and reset to that value here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services