zhaijack commented on a change in pull request #1678: PIP-17: provide 
BlockAwareSegmentInputStream implementation and test
URL: https://github.com/apache/incubator-pulsar/pull/1678#discussion_r185509828
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/s3offload/impl/BlockAwareSegmentInputStream.java
 ##########
 @@ -90,68 +84,60 @@ private int readEntries() throws IOException {
         checkState(bytesReadOffset >= 
DataBlockHeaderImpl.getDataStartOffset());
         checkState(bytesReadOffset < dataBlockFullOffset);
 
-        try {
-            // once reach the end of entry buffer, start a new read.
-            if (entriesByteBuf.isEmpty()) {
-                readNextEntriesFromLedger();
-                log.debug("After readNextEntriesFromLedger: bytesReadOffset: 
{}, blockBytesHave: {}",
-                        bytesReadOffset, blockBytesHave);
-            }
-
-            // always read from the first ByteBuf in the list, once read all 
of its content remove it.
-            ByteBuf entryByteBuf = entriesByteBuf.get(0);
-            int ret = entryByteBuf.readByte();
-            bytesReadOffset ++;
+        // once reach the end of entry buffer, start a new read.
+        if (entriesByteBuf.isEmpty()) {
+            entriesByteBuf = readNextEntriesFromLedger(startEntryId + 
blockEntryCount, ENTRIES_PER_READ);
 
 Review comment:
   it will return empty list, and line 93 will get IndexOutOfBoundsException. 

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

Reply via email to