You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "codelipenghui (via GitHub)" <gi...@apache.org> on 2024/10/14 23:44:01 UTC

[PR] [fix][broker] Do not record as a topic load failure for the requested broker is not the owner [pulsar]

codelipenghui opened a new pull request, #23458:
URL: https://github.com/apache/pulsar/pull/23458

   ### Motivation
   
   The topic_load_failed metric is introduced by https://github.com/apache/pulsar/pull/19236 which is used to monitor the topic load failures such as timeout, metadata service issue, etc.
   
   But the topic owner check exception is an expected behavior if the requested broker is not the owner of the topic. We should avoid to record as a topic load failure from topic owner check. 
   
   ### Verifying this change
   
   - New unit tests were added
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [x] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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


Re: [PR] [fix][broker] Do not record as a topic load failure for the requested broker is not the owner [pulsar]

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui commented on PR #23458:
URL: https://github.com/apache/pulsar/pull/23458#issuecomment-2413009796

   There is a PIP to improve this case https://github.com/apache/pulsar/pull/23351, which is better than just handle the ServiceNotReady exception. I will close this PR.


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


Re: [PR] [fix][broker] Do not record as a topic load failure for the requested broker is not the owner [pulsar]

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui closed pull request #23458: [fix][broker] Do not record as a topic load failure for the requested broker is not the owner
URL: https://github.com/apache/pulsar/pull/23458


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


Re: [PR] [fix][broker] Do not record as a topic load failure for the requested broker is not the owner [pulsar]

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui commented on code in PR #23458:
URL: https://github.com/apache/pulsar/pull/23458#discussion_r1800437709


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1318,8 +1318,9 @@ public void deleteTopicAuthenticationWithRetry(String topic, CompletableFuture<V
     private CompletableFuture<Optional<Topic>> createNonPersistentTopic(String topic) {
         CompletableFuture<Optional<Topic>> topicFuture = new CompletableFuture<>();
         topicFuture.exceptionally(t -> {
+            // If the broker is not the owner of the topic, the client will redirect to another broker.
+            // In this case, we should not record as a topic load failure.
             pulsarStats.recordTopicLoadFailed();
-            pulsar.getExecutor().execute(() -> topics.remove(topic, topicFuture));

Review Comment:
   Oh, it's not intentional. I will revert it back.



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


Re: [PR] [fix][broker] Do not record as a topic load failure for the requested broker is not the owner [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #23458:
URL: https://github.com/apache/pulsar/pull/23458#discussion_r1800425381


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1318,8 +1318,9 @@ public void deleteTopicAuthenticationWithRetry(String topic, CompletableFuture<V
     private CompletableFuture<Optional<Topic>> createNonPersistentTopic(String topic) {
         CompletableFuture<Optional<Topic>> topicFuture = new CompletableFuture<>();
         topicFuture.exceptionally(t -> {
+            // If the broker is not the owner of the topic, the client will redirect to another broker.
+            // In this case, we should not record as a topic load failure.
             pulsarStats.recordTopicLoadFailed();
-            pulsar.getExecutor().execute(() -> topics.remove(topic, topicFuture));

Review Comment:
   Removing this line doesn't seem to be related to topic load failed metrics. Is this intentional?
   It seems that in the original solution this would ensure that failed topics don't added to the topics map.



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