Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][broker] Check replication cluster before starting the replicator #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BewareMyPower
Copy link
Owner

Fixes apache#20010

Motivation

PersistentTopicTest.testCreateTopicWithZombieReplicatorCursor is flaky because the cursor could still be created again in startReplicator, which could be called by:

onPoliciesUpdate
  checkReplicationAndRetryOnFailure
    checkReplication

Modifications

  • Call checkReplicationCluster before calling startReplicator.
  • Support retrying initialize to see if retry works.

Fixes apache#20010

### Motivation

`PersistentTopicTest.testCreateTopicWithZombieReplicatorCursor` is flaky
because `onPoliciesUpdate` is asynchronous, while
`testCreateTopicWithZombieReplicatorCursor` updates the namespace policy
nearly the same time, so there is a race with the order of updating
`AbstractTopic#topicPolicies`.

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

- Sleep 100ms between two calls of updating the replication clusters
- Add the local cluster to the replication cluster list
- Add the retry logic for `initialize`
@BewareMyPower BewareMyPower force-pushed the bewaremypower/issue-20010 branch from f8a5806 to bb254f1 Compare April 11, 2023 04:12
@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky-test: PersistentTopicTest.testCreateTopicWithZombieReplicatorCursor
1 participant