You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/01/04 07:20:18 UTC

[GitHub] merlimat commented on a change in pull request #940: BookieProtoEncoding: remove unnecessary slice() call

merlimat commented on a change in pull request #940: BookieProtoEncoding: remove unnecessary slice() call
URL: https://github.com/apache/bookkeeper/pull/940#discussion_r159591151
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtoEncoding.java
 ##########
 @@ -289,8 +289,8 @@ public Object decode(ByteBuf buffer)
                 entryId = buffer.readLong();
 
                 if (rc == BookieProtocol.EOK) {
-                    ByteBuf content = buffer.slice();
-                    return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId, content.retain());
+                    return new BookieProtocol.ReadResponse(version, rc,
 
 Review comment:
   I'm not 100% sure the `slice()` can be avoided, because we would have to double check all the places that are touching that buffer.
   
   I think a better option here is to use `buffer.retainedSlice()` which achieves both goals (and also lets the resulting `ByteBuf` slice object to be pooled. 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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