[GitHub] ivankelly commented on a change in pull request #1799: BlockAwareSegmentInputStreamImpl shouldn't use LedgerEntry#getLength

2018-05-22 Thread GitBox
ivankelly commented on a change in pull request #1799: 
BlockAwareSegmentInputStreamImpl shouldn't use LedgerEntry#getLength
URL: https://github.com/apache/incubator-pulsar/pull/1799#discussion_r189886758
 
 

 ##
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/s3offload/impl/BlockAwareSegmentInputStreamImpl.java
 ##
 @@ -122,14 +122,15 @@ private int readEntries() throws IOException {
 Iterator iterator = ledgerEntriesOnce.iterator();
 while (iterator.hasNext()) {
 LedgerEntry entry = iterator.next();
-int entryLength = (int) entry.getLength();
+ByteBuf buf = entry.getEntryBuffer().retain();
 
 Review comment:
   they are released when LedgerEntries#close gets called. It gets called 
through the try-with-resource block. CompositeByteBuf doesn't retain, so we 
have to call retain explicitly before passing it.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] ivankelly commented on a change in pull request #1799: BlockAwareSegmentInputStreamImpl shouldn't use LedgerEntry#getLength

2018-05-17 Thread GitBox
ivankelly commented on a change in pull request #1799: 
BlockAwareSegmentInputStreamImpl shouldn't use LedgerEntry#getLength
URL: https://github.com/apache/incubator-pulsar/pull/1799#discussion_r189098223
 
 

 ##
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/s3offload/impl/BlockAwareSegmentInputStreamImpl.java
 ##
 @@ -122,14 +122,15 @@ private int readEntries() throws IOException {
 Iterator iterator = ledgerEntriesOnce.iterator();
 while (iterator.hasNext()) {
 LedgerEntry entry = iterator.next();
-int entryLength = (int) entry.getLength();
+ByteBuf buf = entry.getEntryBuffer().retain();
 
 Review comment:
   The refCount for this retain has its ownership transferred to the composite 
bytebuf created below, so it will get released when that bytebuf is released.


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:
us...@infra.apache.org


With regards,
Apache Git Services