petersomogyi commented on code in PR #8128:
URL: https://github.com/apache/hbase/pull/8128#discussion_r3166975408


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DataTieringManager.java:
##########
@@ -347,4 +387,29 @@ private static boolean 
isDataTieringFeatureEnabled(Configuration conf) {
   public static void resetForTestingOnly() {
     instance = null;
   }
+
+  public Map<String, Pair<List<String>, Long>> getRegionColdDataSize() {
+    return regionColdDataSize;
+  }
+
+  /**
+   * Updates regionColdData size for the region containing the passed 
compactedFiles.
+   */
+  public void updateRegionColdDataSize(String encodedRegionName,
+    Collection<HStoreFile> compactedFiles, Collection<HStoreFile> newFiles) {
+    regionColdDataSize.computeIfPresent(encodedRegionName, (k, v) -> {
+      for (HStoreFile file : compactedFiles) {
+        if (v.getFirst().contains(file.getPath().getName())) {
+          v.getFirst().remove(file.getPath().getName());
+          v.setSecond(v.getSecond() - 
Bytes.toLong(file.getMetadataValue(FILE_SIZE)));
+        }
+      }
+      for (HStoreFile file : newFiles) {
+        // call isHotData to account for the new file size in 
regionColdDataSize, if the new file is
+        // considered cold data as per data-tiering logic.
+        isHotData(file.getFileInfo().getHFileInfo(), 
file.getFileInfo().getConf());

Review Comment:
   Thanks for taking a look and adding a unit test for 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: [email protected]

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

Reply via email to