Skip to content

[fix] [broker] Fix metrics pulsar_topic_load_failed_count is 0 when load non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed#22580

Merged
lhotari merged 1 commit intoapache:masterfrom
poorbarcode:fix/metrics_load_topic_fails
Apr 29, 2024

Conversation

@poorbarcode
Copy link
Contributor

@poorbarcode poorbarcode commented Apr 25, 2024

Fixes: #20495

Motivation

  1. The test BrokerServiceTest.testBrokerStatsTopicLoadFailed always fails, so [fix][test] Disable invalid test BrokerServiceTest#testBrokerStatsTopicLoadFailed #20494 disabled it.
  2. There is a case that pulsar_topic_load_failed_count does not increase when load non-persistent topic fails[1].

[1]: https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L1239-L1258

CompletableFuture<Optional<Topic>> topicFuture = new CompletableFuture<>();
topicFuture.exceptionally(t -> {
    pulsarStats.recordTopicLoadFailed();
    return null;
});
try {
    nonPersistentTopic = newTopic(topic, null, this, NonPersistentTopic.class);
} catch (Throwable e) {
    log.warn("Failed to create topic {}", topic, e);
    // Highlight: It is a new future, so the event `topicFuture.exceptionally` will not receive the error callback anymore.
    return FutureUtil.failedFuture(e);
}

Modifications

  1. fix the test.
  2. fix the issue

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: x

@poorbarcode poorbarcode added this to the 3.3.0 milestone Apr 25, 2024
@poorbarcode poorbarcode self-assigned this Apr 25, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Apr 25, 2024
@poorbarcode poorbarcode changed the title [fix] [broker] [fix] [broker] Fix metrics pulsar_topic_load_failed_count is 0 when load non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed [fix] [broker] Fix metrics pulsar_topic_load_failed_count is 0 when load non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed Apr 28, 2024
@poorbarcode
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed
@poorbarcode poorbarcode force-pushed the fix/metrics_load_topic_fails branch from 4b0dffb to 83e0dce Compare April 29, 2024 03:28
@poorbarcode
Copy link
Contributor Author

Rebase master

@lhotari lhotari merged commit 340d60d into apache:master Apr 29, 2024
poorbarcode added a commit that referenced this pull request May 2, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (#22580)

(cherry picked from commit 340d60d)
poorbarcode added a commit that referenced this pull request May 2, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (#22580)

(cherry picked from commit 340d60d)
poorbarcode added a commit that referenced this pull request May 2, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (#22580)

(cherry picked from commit 340d60d)
poorbarcode added a commit that referenced this pull request May 2, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (#22580)

(cherry picked from commit 340d60d)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request May 13, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (apache#22580)

(cherry picked from commit 340d60d)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request May 13, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (apache#22580)

(cherry picked from commit 340d60d)
(cherry picked from commit 053c455)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request May 16, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (apache#22580)

(cherry picked from commit 340d60d)
(cherry picked from commit 053c455)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Jun 7, 2024
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (apache#22580)

(cherry picked from commit 340d60d)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (apache#22580)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite BrokerServiceTest#testBrokerStatsTopicLoadFailed

4 participants