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


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java:
##########
@@ -775,19 +779,21 @@ public void fileCacheCompleted(Path filePath, long size) {
     fullyCachedFiles.put(filePath.getName(), pair);
   }
 
-  private void updateRegionCachedSize(Path filePath, long cachedSize) {
-    if (filePath != null) {
-      if (HFileArchiveUtil.isHFileArchived(filePath)) {
-        LOG.trace("Skipping region cached size update for archived file: {}", 
filePath);
+  private void updateRegionCachedSize(BlockCacheKey key, long cachedSize) {
+    if (key.getRegionName() != null) {
+      if (key.isArchived()) {
+        LOG.trace("Skipping region cached size update for archived file:{} 
from region: {}",
+          key.getHfileName(), key.getRegionName());
       } else {
-        String regionName = filePath.getParent().getParent().getName();
+        String regionName = key.getRegionName();
         regionCachedSize.merge(regionName, cachedSize,
           (previousSize, newBlockSize) -> previousSize + newBlockSize);
         LOG.trace("Updating region cached size for region: {}", regionName);
         // If all the blocks for a region are evicted from the cache,
         // remove the entry for that region from regionCachedSize map.
         if (regionCachedSize.get(regionName) <= 0) {
           regionCachedSize.remove(regionName);
+          FilePathStringPool.getInstance().remove(regionName);

Review Comment:
   The assumption here is that if `regionCachedSize.get(regionName) <= 0`, we 
are guaranteed to have removed all BlockCacheKeys that refer to that region.



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