virajjasani commented on a change in pull request #3215:
URL: https://github.com/apache/hbase/pull/3215#discussion_r638125789
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/TinyLfuBlockCache.java
##########
@@ -158,7 +158,13 @@ public boolean containsBlock(BlockCacheKey cacheKey) {
@Override
public Cacheable getBlock(BlockCacheKey cacheKey,
boolean caching, boolean repeat, boolean updateCacheMetrics) {
- Cacheable value = cache.getIfPresent(cacheKey);
+ Cacheable value = cache.asMap().computeIfPresent(cacheKey, (blockCacheKey,
cacheable) -> {
+ // It will be referenced by RPC path, so increase here. NOTICE: Must do
the retain inside
+ // this block. because if retain outside the map#computeIfPresent, the
evictBlock may remove
+ // the block and release, then we're retaining a block with refCnt=0
which is disallowed.
+ cacheable.retain();
+ return cacheable;
+ });
Review comment:
Hmm, yeah locks would slow us down. On the other hand, based on
discussion on HBASE-22422 , it seems computeIfPresent (locking) is necessary to
prevent concurrency issues with #retain and #release.
Based on @openinx's comment
[here](https://issues.apache.org/jira/browse/HBASE-22422?focusedCommentId=16848024&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16848024),
wondering if the sawtooth graph of QPS is similar concurrency issue and not
resolved yet.
@saintstack Any suggestions? Have you been using Offheap read path with LRU
recently?
--
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]