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


##########
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:
   > Second case: work with compaction 
   > - After the compaction, if the new client connects, the messages read 
first will have messageIds from the compacted ledger. Will compareTo work in 
that case?
   
   Messages read from a compacted topic by a normal client will be no different 
to messages read from a non-compacted topic, though there will be gaps in the 
message IDs. See https://github.com/apache/pulsar/wiki/PIP-14:-Topic-compaction



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