openinx commented on a change in pull request #479: HBASE-22802 Avoid temp 
ByteBuffer allocation in FileIOEngine#read
URL: https://github.com/apache/hbase/pull/479#discussion_r314964870
 
 

 ##########
 File path: hbase-common/src/main/java/org/apache/hadoop/hbase/nio/ByteBuff.java
 ##########
 @@ -78,6 +79,14 @@ public boolean release() {
     return refCnt.release();
   }
 
+  public RefCnt getRefCnt() {
+    return this.refCnt;
+  }
+
+  public void setRefCnt(RefCnt refCnt) {
 
 Review comment:
   I think setRefCnt for a given ByteBuff is dangerous ?  because its previous 
recycler will be lost, so better not to expose this method as public ? We have 
one similar issue before, see: 
   ```
     /**
      * In theory, the upstream should never construct an ByteBuff by passing 
an given refCnt, so
      * please don't use this public method in other place. Make the method 
public here because the
      * BucketEntry#wrapAsCacheable in hbase-server module will use its own 
refCnt and ByteBuffers from
      * IOEngine to composite an HFileBlock's ByteBuff, we didn't find a better 
way so keep the public
      * way here.
      */
     public static ByteBuff wrap(ByteBuffer[] buffers, RefCnt refCnt) {
   ```

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