wchevreuil commented on code in PR #5905:
URL: https://github.com/apache/hbase/pull/5905#discussion_r1603657884


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java:
##########
@@ -1357,9 +1357,16 @@ public HFileBlock readBlock(long dataBlockOffset, long 
onDiskBlockSize, final bo
         BlockType.BlockCategory category = 
hfileBlock.getBlockType().getCategory();
         final boolean cacheCompressed = 
cacheConf.shouldCacheCompressed(category);
         final boolean cacheOnRead = cacheConf.shouldCacheBlockOnRead(category);
+        Optional<Boolean> cacheFileBlock = Optional.of(true);
+        // Additionally perform the time-based priority checks to see
+        // whether, or not to cache the block.
+        if (cacheConf.getBlockCache().isPresent()) {
+          cacheFileBlock = 
cacheConf.getBlockCache().get().shouldCacheFile(getHFileInfo(), conf);
+        }
+        final boolean shouldCacheFileBlock = cacheFileBlock.get();
 

Review Comment:
   I'm fine with have multiple `shouldCache` methods, or even overloaded 
versions of `shouldCacheBlockOnRead`, but can't we have one `shouldCache` like 
method in CacheConfig that combines both checks? That way HFileReaderImpl code 
doesn't need to reference multiple checks and add different boolean variables 
each time it needs to check it.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to