diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java index 67f64d5b180..de7abd2b46b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java @@ -475,7 +475,6 @@ public class BucketCache implements BlockCache, HeapSize { } else { this.blockNumber.increment(); this.heapSize.add(cachedItem.heapSize()); - blocksByHFile.add(cacheKey); } } @@ -1016,6 +1015,11 @@ public class BucketCache implements BlockCache, HeapSize { index++; continue; } + BlockCacheKey cacheKey = re.getKey(); + if (ramCache.containsKey(cacheKey)) { + blocksByHFile.add(cacheKey); + } + BucketEntry bucketEntry = re.writeToCache(ioEngine, bucketAllocator, realCacheSize, this::createRecycler); // Successfully added. Up index and add bucketEntry. Clear io exceptions.