gaozhangmin commented on code in PR #15178:
URL: https://github.com/apache/pulsar/pull/15178#discussion_r852687865


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java:
##########
@@ -224,9 +224,23 @@ private CompletableFuture<Reader<T>> newReader(String 
partition) {
                 .readCompacted(true)
                 .poolMessages(true)
                 .createAsync()
+                .thenCompose(this::cacheNewReader)
                 .thenCompose(this::readAllExistingMessages);
     }
 
+    private CompletableFuture<Reader<T>> cacheNewReader(Reader<T> reader) {
+        CompletableFuture<Reader<T>> future = new CompletableFuture<>();
+        if (this.readers.containsKey(reader.getTopic())) {

Review Comment:
   Why  `readers.containsKey` checked twice?  the previous check is in `start` 
method
   ```
    // Add new Partitions
                       partitions.forEach(partition -> {
                           if (!readers.containsKey(partition)) {
                               futures.add(newReader(partition));
                           }
                       });
   ```



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