comnetwork commented on a change in pull request #3680:
URL: https://github.com/apache/hbase/pull/3680#discussion_r708807904



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
##########
@@ -550,13 +555,29 @@ public Cacheable getBlock(BlockCacheKey key, boolean 
caching, boolean repeat,
     return null;
   }
 
+  /**
+   * This method is invoked after the bucketEntry is removed from {@link 
BucketCache#backingMap}
+   * @param cacheKey
+   * @param bucketEntry
+   * @param decrementBlockNumber
+   */
   void blockEvicted(BlockCacheKey cacheKey, BucketEntry bucketEntry, boolean 
decrementBlockNumber) {
-    bucketAllocator.freeBlock(bucketEntry.offset());
-    realCacheSize.add(-1 * bucketEntry.getLength());
+    bucketEntry.markAsEvicted();
     blocksByHFile.remove(cacheKey);
     if (decrementBlockNumber) {
       this.blockNumber.decrement();
     }
+    cacheStats.evicted(bucketEntry.getCachedTime(), cacheKey.isPrimary());
+  }
+
+  /**
+   * Free the {{@link BucketEntry} actually,which could only be invoked when 
the
+   * {@link BucketEntry#refCnt} becoming 0.
+   * @param bucketEntry

Review comment:
       Fix 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