ramkrish86 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_r287636742
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlockIndex.java
 ##########
 @@ -313,10 +313,13 @@ public BlockWithScanInfo loadDataBlockWithScanInfo(Cell 
key, HFileBlock currentB
       int index = -1;
 
       HFileBlock block = null;
-      boolean dataBlock = false;
       KeyOnlyKeyValue tmpNextIndexKV = new KeyValue.KeyOnlyKeyValue();
       while (true) {
         try {
+          // Must initialize it with null here, because if don't and once an 
exception happen in
+          // readBlock, then we'll release the previous assigned block twice 
in the finally block.
+          // (See HBASE-22422)
+          block = null;
 
 Review comment:
   Good catch.
   

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

Reply via email to