You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/06 14:25:29 UTC

[GitHub] [pulsar] Jason918 opened a new pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Jason918 opened a new pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134


   
   Fixes #14105
   
   
   ### Motivation
   
   See #14105
   
   ### Modifications
   
   The root cause is that when we call `TopicLookupBase#internalLookupTopicAsync` --> `NamespaceService#checkTopicExists` --> `BrokerService#getTopicIfExists` during lookup request handing, non-persistent partitioned topic is auto created at
   https://github.com/apache/pulsar/blob/00e7cc6e3429d38d6e24af3dc5a840ff9a73601f/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L949-L956
   
   But the ns bundle may not bind to this broker yet, so this PR resolve this issue by avoid creating any topics in `NamespaceService#checkTopicExists`.
   
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change is already covered by existing tests, such as AdminApi2Test.testGetListInBundle
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
   Check the box below and label this PR (if you have committer privilege).
   
   Need to update docs? 
     
   - [x] `no-need-doc` 
   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on a change in pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on a change in pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134#discussion_r800258829



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java
##########
@@ -1098,9 +1099,14 @@ public ServiceUnitId getServiceUnitId(TopicName topicName) throws Exception {
         if (topic.isPersistent()) {
             return pulsar.getPulsarResources().getTopicResources().persistentTopicExists(topic);
         } else {
-            return pulsar.getBrokerService()
-                    .getTopicIfExists(topic.toString())
-                    .thenApply(optTopic -> optTopic.isPresent());
+            // only checks and don't do any topic creating and loading.
+            CompletableFuture<Optional<Topic>> topicFuture =
+                    pulsar.getBrokerService().getTopics().get(topic.toString());
+            if (topicFuture == null) {
+                return CompletableFuture.completedFuture(false);
+            } else {
+                return topicFuture.thenApply(Optional::isPresent).exceptionally(throwable -> false);

Review comment:
       Maybe we need to log in ``exceptionally``.




-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao commented on pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134#issuecomment-1030995017


   it seems to have some conflict for this PR #9173.
   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] Jason918 commented on pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
Jason918 commented on pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134#issuecomment-1031004783


   > 
   
   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] Jason918 closed pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
Jason918 closed pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134


   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] Jason918 commented on pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
Jason918 commented on pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134#issuecomment-1031006285


   > I change my mind. we need to resolve the conflict for this PR #9786
   
   There is no conflict since #9786 should be applied after lookup, like `Producer` and `Subscribe` command.
   This PR does not change 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: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] mattisonchao removed a comment on pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
mattisonchao removed a comment on pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134#issuecomment-1030995017


   it seems to have some conflict for this PR #9173.
   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] Jason918 removed a comment on pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
Jason918 removed a comment on pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134#issuecomment-1031004783


   > 
   
   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] codelipenghui merged pull request #14134: [Issue 14105] Avoid creating any topics in `NamespaceService#checkTopicExists` during topic lookup.

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #14134:
URL: https://github.com/apache/pulsar/pull/14134


   


-- 
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-unsubscribe@pulsar.apache.org

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