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


##########
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:
   Got it. How should I proceed? The `DataTieringManager#isHotData()` method 
requires `HFilePreadReader`. Should I update the existing `shouldCacheFile` 
method to pass `HFilePreadReader` like this?
   ```
   @Override
     public Optional<Boolean> shouldCacheFile(HFilePreadReader reader) {
       try {
         DataTieringManager dataTieringManager = 
DataTieringManager.getInstance();
         if (!dataTieringManager.isHotData(reader)) {
           LOG.debug("Data tiering is enabled for path '{}' and it is not hot 
data", reader.getPath());
           return Optional.of(false);
         }
       } catch (IllegalStateException e) {
         LOG.error("Error while getting DataTieringManager instance: {}", 
e.getMessage());
       }
       
       // if we don't have the file in fullyCachedFiles, we should cache it
       String fileName = reader.getPath().getName();
       return Optional.of(!fullyCachedFiles.containsKey(fileName));
     }
   ```



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