This is an automated email from the ASF dual-hosted git repository.

thetumbled pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new b661ec82d20 [improve][broker] Improve pulsar_topic_load_failed metric 
to record correct failed time (#23199)
b661ec82d20 is described below

commit b661ec82d20adb71c0fe00ad115ec1ab71327880
Author: ken <[email protected]>
AuthorDate: Wed Aug 21 11:06:35 2024 +0800

    [improve][broker] Improve pulsar_topic_load_failed metric to record correct 
failed time (#23199)
    
    Co-authored-by: fanjianye <[email protected]>
---
 .../java/org/apache/pulsar/broker/service/BrokerService.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
index 066bfc98cc0..e5248d45d42 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
@@ -1586,6 +1586,11 @@ public class BrokerService implements Closeable {
                 
Duration.ofSeconds(pulsar.getConfiguration().getTopicLoadTimeoutSeconds()), 
executor(),
                 () -> FAILED_TO_LOAD_TOPIC_TIMEOUT_EXCEPTION);
 
+        topicFuture.exceptionally(t -> {
+            pulsarStats.recordTopicLoadFailed();
+            return null;
+        });
+
         checkTopicNsOwnership(topic)
                 .thenRun(() -> {
                     final Semaphore topicLoadSemaphore = 
topicLoadRequestSemaphore.get();
@@ -1700,11 +1705,6 @@ public class BrokerService implements Closeable {
         TopicName topicName = TopicName.get(topic);
         final long topicCreateTimeMs = 
TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
 
-        topicFuture.exceptionally(t -> {
-            pulsarStats.recordTopicLoadFailed();
-            return null;
-        });
-
         if (isTransactionInternalName(topicName)) {
             String msg = String.format("Can not create transaction system 
topic %s", topic);
             log.warn(msg);

Reply via email to