horizonzy commented on code in PR #15063:
URL: https://github.com/apache/pulsar/pull/15063#discussion_r869394711
##########
tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlockAwareSegmentInputStreamImpl.java:
##########
@@ -87,6 +94,50 @@ public BlockAwareSegmentInputStreamImpl(ReadHandle ledger,
long startEntryId, in
this.topicName = ledgerName;
}
+ private ByteBuf readEntries(int len) throws IOException {
+ checkState(bytesReadOffset >=
DataBlockHeaderImpl.getDataStartOffset());
+ checkState(bytesReadOffset < blockSize);
+
+ // once reach the end of entry buffer, read more, if there is more
+ if (bytesReadOffset < dataBlockFullOffset
+ && entriesByteBuf.isEmpty()
+ && startEntryId + blockEntryCount <= ledger.getLastAddConfirmed())
{
+ entriesByteBuf = readNextEntriesFromLedger(startEntryId +
blockEntryCount, ENTRIES_PER_READ);
+ }
+
+ if (!entriesByteBuf.isEmpty()
+ && bytesReadOffset + entriesByteBuf.get(0).readableBytes() <=
blockSize) {
Review Comment:
Needn't check every time, maybe it just need check then entriesByteBuf's 0
element changes.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]