openinx commented on a change in pull request #242: HBASE-22422 Retain an
ByteBuff with refCnt=0 when getBlock from LRUCache
URL: https://github.com/apache/hbase/pull/242#discussion_r284963888
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
##########
@@ -611,6 +609,10 @@ protected long evictBlock(LruCachedBlock block, boolean
evictedByEvictionProcess
victimHandler.cacheBlock(block.getCacheKey(), block.getBuffer());
}
}
+ // Decrease the block's reference count, and if refCount is 0, then it'll
auto-deallocate. DO
+ // NOT move this up because if do that then the victimHandler may access
the buffer with
+ // refCnt = 0 which is disallowed.
+ previous.getBuffer().release();
Review comment:
> Why in victimHandler we will access the previous? And is it possible to
add a UT?
For InclusiveCombinedBlockCache , we will move the evicted block from
LRUCache to an larger L2 cache (such as MemcachedBlockCache for longer caching
I think), So if release in line#596, then victimHandler will cache an block
which point to an unknown area because its memory has been free.
Yeah, will provide a UT.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services