michalcukierman commented on code in PR #21170:
URL: https://github.com/apache/pulsar/pull/21170#discussion_r1337233171


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java:
##########
@@ -235,20 +238,33 @@ private CompletableFuture<Reader<T>> 
readAllExistingMessages(Reader<T> reader) {
         AtomicLong messagesRead = new AtomicLong();
 
         CompletableFuture<Reader<T>> future = new CompletableFuture<>();
-        readAllExistingMessages(reader, future, startTime, messagesRead);
+        reader.getLastMessageIdsAsync().thenAccept(lastMessageIds -> {
+            Optional<TopicMessageId> optionalTopicMessageId = 
lastMessageIds.stream().max(Comparator.naturalOrder());

Review Comment:
   Just to consider:
   If the compacted ledger is created after the ledger that holds the backlog, 
it may have the higher ledger Id, right?
   
   - So you reed the latest message from the backlog
   - You start reading from the beginning (compacted ledger, first message)
   - The compacted ledger has higher ID, therefore the MessageId.equals won't 
work as expected
   
   Is there a mechanism to prevent that?
   
   



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

Reply via email to