liangyepianzhou commented on a change in pull request #12449:
URL: https://github.com/apache/pulsar/pull/12449#discussion_r734183213



##########
File path: 
tiered-storage/file-system/src/main/java/org/apache/bookkeeper/mledger/offload/filesystem/impl/FileStoreBackedReadHandleImpl.java
##########
@@ -105,30 +105,22 @@ public LedgerMetadata getLedgerMetadata() {
                 promise.completeExceptionally(new 
BKException.BKIncorrectParameterException());
                 return;
             }
-            long entriesToRead = (lastEntry - firstEntry) + 1;
             List<LedgerEntry> entries = new ArrayList<LedgerEntry>();
-            long nextExpectedId = firstEntry;
             LongWritable key = new LongWritable();
             BytesWritable value = new BytesWritable();
             try {
-                key.set(nextExpectedId - 1);
+                key.set(firstEntry - 1);
                 reader.seek(key);
-                while (entriesToRead > 0) {
-                    reader.next(key, value);
+                reader.next(key, value);

Review comment:
       value.getLength() will be 0. And  the entries will get. a entry which 
the length is 0. 
   And then the exception will not be thrown when ` 
LedgerEntriesImpl.create(entries)`.




-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to