You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/05/16 14:05:31 UTC

[GitHub] [hbase] Apache9 commented on a change in pull request #242: HBASE-22422 Retain an ByteBuff with refCnt=0 when getBlock from LRUCache

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

 ##########
 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:
   So this is the problem. Mind explaining more? Why in victimHandler we will access the previous? And is it possible to add 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:
users@infra.apache.org


With regards,
Apache Git Services