poorbarcode commented on code in PR #19498:
URL: https://github.com/apache/pulsar/pull/19498#discussion_r1107343111


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java:
##########
@@ -790,7 +790,10 @@ public CompletableFuture<Void> seekAsync(MessageId 
messageId) {
     public CompletableFuture<Void> seekAsync(long timestamp) {
         List<CompletableFuture<Void>> futures = new 
ArrayList<>(consumers.size());
         consumers.values().forEach(consumer -> 
futures.add(consumer.seekAsync(timestamp)));
-        return FutureUtil.waitForAll(futures);
+        return FutureUtil.waitForAll(futures).thenApply(f -> {
+                    clearIncomingMessages();

Review Comment:
   If a task runs at this line below, we call it `receiving-task`.
   
   
https://github.com/apache/pulsar/blob/f9af4245e0b05c382656fc674fdaeda26487258c/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java#L244
   
   Then is there a scenario like this?
   
   | time | `receiving-task` | `seek task` |
   | --- | --- | --- |
   | 1 | `receiving-task` started, and it is not finished | | 
   | 2 |  | seek | 
   | 3 |  | clear the `incoming queue` after seeking |
   | 4 | `receiving-task` finished, and push messages to `incoming queue` |
   | 5 |  | receive messages |
   
   Then the consumer receives duplicated messages



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