vinayakphegde commented on code in PR #5808:
URL: https://github.com/apache/hbase/pull/5808#discussion_r1562404151


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePreadReader.java:
##########
@@ -37,6 +38,17 @@ public class HFilePreadReader extends HFileReaderImpl {
   public HFilePreadReader(ReaderContext context, HFileInfo fileInfo, 
CacheConfig cacheConf,
     Configuration conf) throws IOException {
     super(context, fileInfo, cacheConf, conf);
+
+    try {
+      DataTieringManager dataTieringManager = DataTieringManager.getInstance();
+      if (!dataTieringManager.isHotData(this)) {
+        LOG.debug("Data tiering is enabled for path '{}' and it is not hot 
data", path);
+        return;
+      }
+    } catch (IllegalStateException e) {
+      LOG.error("Error while getting DataTieringManager instance: {}", 
e.getMessage());

Review Comment:
   Another option is something like below.
   ```
   public HFilePreadReader(ReaderContext context, HFileInfo fileInfo, 
CacheConfig cacheConf,
       Configuration conf) throws IOException {
       super(context, fileInfo, cacheConf, conf);
   
       boolean isHotData = true;
       try {
         DataTieringManager dataTieringManager = 
DataTieringManager.getInstance();
         isHotData = dataTieringManager.isHotData(this);
       } catch (IllegalStateException e) {
         LOG.error("Error while getting DataTieringManager instance: {}", 
e.getMessage());
       }
   
       final MutableBoolean shouldCache = new MutableBoolean(true);
   
       boolean finalIsHotData = isHotData;
       cacheConf.getBlockCache().ifPresent(cache -> {
         Optional<Boolean> result = cache.shouldCacheFile(path.getName(), 
finalIsHotData);
         shouldCache.setValue(result.isPresent() ? result.get().booleanValue() 
: true);
       });
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to