Commit f8a5806
committed
[fix][broker] Check replication cluster before starting the replicator
Fixes #20010
### Motivation
`PersistentTopicTest.testCreateTopicWithZombieReplicatorCursor` is flaky
because the cursor could still be created again in `startReplicator`,
which could be called by:
```
onPoliciesUpdate
checkReplicationAndRetryOnFailure
checkReplication
```
Sometimes the policies update might fail because the topic might be
deleted in `PersistentTopic#checkReplication`:
> Deleting topic [xxx] because local cluster is not part of global namespace repl list [remote]
### Modifications
- Call `checkReplicationCluster` before calling `startReplicator`.
- Add the local cluster to the replication cluster list
- Sleep for a while in the test to reduce the flakiness caused by the
asynchronous update of the policies1 parent 42a6969 commit f8a5806
2 files changed
Lines changed: 29 additions & 8 deletions
File tree
- pulsar-broker/src
- main/java/org/apache/pulsar/broker/service/persistent
- test/java/org/apache/pulsar/broker/service/persistent
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1542 | 1542 | | |
1543 | 1543 | | |
1544 | 1544 | | |
1545 | | - | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
1546 | 1552 | | |
1547 | 1553 | | |
1548 | 1554 | | |
| |||
Lines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
558 | 562 | | |
559 | 563 | | |
560 | 564 | | |
561 | | - | |
| 565 | + | |
562 | 566 | | |
563 | 567 | | |
564 | | - | |
| 568 | + | |
565 | 569 | | |
566 | 570 | | |
567 | 571 | | |
| |||
576 | 580 | | |
577 | 581 | | |
578 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
579 | 588 | | |
580 | | - | |
| 589 | + | |
581 | 590 | | |
582 | | - | |
| 591 | + | |
583 | 592 | | |
584 | 593 | | |
585 | 594 | | |
586 | 595 | | |
587 | | - | |
588 | | - | |
589 | | - | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
590 | 605 | | |
591 | 606 | | |
0 commit comments