Skip to content

Conversation

@poorbarcode
Copy link
Contributor

Fixes #24583

Motivation & Modifications

fix the flaky test testReplicatorsInflightTaskListIsEmptyAfterReplicationFinished

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 4.1.0 milestone Jul 30, 2025
@poorbarcode poorbarcode self-assigned this Jul 30, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 30, 2025
@poorbarcode poorbarcode added release/4.0.7 release/3.0.14 release/3.3.9 and removed doc-not-needed Your PR changes do not impact docs labels Jul 30, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 30, 2025
Copy link
Contributor

@BewareMyPower BewareMyPower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one point that is not explained by the comments.

If the test in #24583 (comment) is added based on commit 671994f (the latest commit before #24189), the test will pass.

But if the test is added to master branch, it will always fail.

@BewareMyPower BewareMyPower dismissed their stale review July 30, 2025 14:05

Got the reason

…neWayReplicatorTest.java

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
@BewareMyPower
Copy link
Contributor

I got the reason now. After cluster A created a topic, the creation of the replicator producer will trigger the topic creation of cluster B. i.e. the following code has a great chance to fail:

        final String topic = "persistent://" + replicatedNamespace + "/topic";
        admin1.topics().createNonPartitionedTopic(topic);
        Thread.sleep(1000);
        admin2.topics().createNonPartitionedTopic(topic);

#24189 somehow speeds up the creation of the replication producer. BTW, I found the issue also from my improvements in topic loading. It should be the same reason.

Regarding the following test:

    @Test
    public void test() throws Exception {
        final String topic1 = "persistent://" + replicatedNamespace + "/tp1";
        admin1.topics().createPartitionedTopic(topic1, 2);
        admin1.topicPolicies().setMessageTTL(topic1, 100);

        final String topic2 = "persistent://" + replicatedNamespace + "/tp2";
        admin2.topics().createNonPartitionedTopic(topic2);
        admin2.topics().createSubscription(topic2, "sub", MessageId.earliest);

        admin1.topics().createNonPartitionedTopic(topic2);
    }

Question 1: why removing admin1.topicPolicies().setMessageTTL(topic1, 100) will make the test pass

Because after that, admin1.topics().createNonPartitionedTopic(topic2); will trigger the loading on topic __change_events, including the reader creation and the read loop, which could cost some time.

Question 2: why removing admin2.topics().createSubscription(topic2, "sub", MessageId.earliest); will make the test pass

Because creating a subscription will cost some time as well.

@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.29%. Comparing base (bbc6224) to head (887850a).
⚠️ Report is 1250 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24590      +/-   ##
============================================
+ Coverage     73.57%   74.29%   +0.72%     
- Complexity    32624    33027     +403     
============================================
  Files          1877     1880       +3     
  Lines        139502   146419    +6917     
  Branches      15299    16785    +1486     
============================================
+ Hits         102638   108783    +6145     
- Misses        28908    28995      +87     
- Partials       7956     8641     +685     
Flag Coverage Δ
inttests 26.80% <ø> (+2.22%) ⬆️
systests 23.35% <ø> (-0.98%) ⬇️
unittests 73.78% <ø> (+0.93%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1123 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lhotari lhotari changed the title [fix][broker]Fix flaky test testReplicatorsInflightTaskListIsEmptyAfterReplicationFinished [fix][broker] Fix flaky test testReplicatorsInflightTaskListIsEmptyAfterReplicationFinished Jul 30, 2025
@lhotari lhotari changed the title [fix][broker] Fix flaky test testReplicatorsInflightTaskListIsEmptyAfterReplicationFinished [fix][broker] Fix flaky testReplicatorsInflightTaskListIsEmptyAfterReplicationFinished Jul 30, 2025
@lhotari lhotari merged commit 3ea8c26 into apache:master Jul 30, 2025
53 of 54 checks passed
lhotari pushed a commit that referenced this pull request Jul 30, 2025
…plicationFinished (#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
(cherry picked from commit 3ea8c26)
lhotari pushed a commit that referenced this pull request Jul 30, 2025
…plicationFinished (#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
(cherry picked from commit 3ea8c26)
lhotari pushed a commit that referenced this pull request Jul 30, 2025
…plicationFinished (#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
(cherry picked from commit 3ea8c26)
gaozhangmin pushed a commit to gaozhangmin/pulsar that referenced this pull request Aug 13, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
poorbarcode added a commit to poorbarcode/pulsar that referenced this pull request Aug 14, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Aug 20, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
(cherry picked from commit 3ea8c26)
(cherry picked from commit ff86be1)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Aug 20, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
(cherry picked from commit 3ea8c26)
(cherry picked from commit ff86be1)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Aug 20, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
(cherry picked from commit 3ea8c26)
(cherry picked from commit b8670b5)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Aug 26, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
(cherry picked from commit 3ea8c26)
(cherry picked from commit b8670b5)
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
…plicationFinished (apache#24590)

Co-authored-by: Yunze Xu <xyzinfernity@163.com>
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.

[Bug] OneWayReplicatorUsingGlobalPartitionedTest.testReplicatorsInflightTaskListIsEmptyAfterReplicationFinished failed on master branch

4 participants