merlimat closed pull request #1799: BlockAwareSegmentInputStreamImpl shouldn't use LedgerEntry#getLength URL: https://github.com/apache/incubator-pulsar/pull/1799
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/s3offload/impl/BlockAwareSegmentInputStreamImpl.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/s3offload/impl/BlockAwareSegmentInputStreamImpl.java index 0fdf48f7f8..03ae702d97 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/s3offload/impl/BlockAwareSegmentInputStreamImpl.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/s3offload/impl/BlockAwareSegmentInputStreamImpl.java @@ -122,14 +122,15 @@ private int readEntries() throws IOException { Iterator<LedgerEntry> iterator = ledgerEntriesOnce.iterator(); while (iterator.hasNext()) { LedgerEntry entry = iterator.next(); - int entryLength = (int) entry.getLength(); + ByteBuf buf = entry.getEntryBuffer().retain(); + int entryLength = buf.readableBytes(); long entryId = entry.getEntryId(); CompositeByteBuf entryBuf = PooledByteBufAllocator.DEFAULT.compositeBuffer(2); ByteBuf entryHeaderBuf = PooledByteBufAllocator.DEFAULT.buffer(ENTRY_HEADER_SIZE, ENTRY_HEADER_SIZE); entryHeaderBuf.writeInt(entryLength).writeLong(entryId); - entryBuf.addComponents(true, entryHeaderBuf, entry.getEntryBuffer().retain()); + entryBuf.addComponents(true, entryHeaderBuf, buf); entries.add(entryBuf); } ---------------------------------------------------------------- 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