Skip to content

[Bug] Applying Pulsar Topic Policies fails when multiple policies are updated in a short period of time #24393

@shasank112001

Description

@shasank112001

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

User environment

Pulsar Version = 4.0.3
OS = Linux
Java Version = 21
Client Library Version = 4.0.3 (Pulsar-Admin)
Client OS = Darwin (Mac)
Client Java Version = 21

Issue Description

I have a function to create topics and apply policies on that topic.

admin.topicPolicies().setInactiveTopicPolicies(pulsarTopic, policies.inactive_topic_policies);

admin.topics().setReplicationClusters(pulsarTopic, List.of("cluster-a", "cluster-b"));

admin.topicPolicies().setSubscriptionTypesEnabledAsync(pulsarTopic, Set.of(SubscriptionType.Shared));

admin.topics().updateProperties(pulsarTopic, policies.properties);

However, after applying these, when I verify the results I get mismatching results:

  1. replication clusters is null (if I do with "applied"=true, I only get 1 cluster name)
  2. subscriptionTypesEnabled = [].

If I introduce a 1 second delay between each of the commands using Thread.sleep(1000), then I don't get these errors.

Also the following order of commands works as well :

admin.topics().setReplicationClusters(pulsarTopic, List.of("cluster-a", "cluster-b"));

admin.topicPolicies().setInactiveTopicPolicies(pulsarTopic, policies.inactive_topic_policies);

admin.topics().updateProperties(pulsarTopic, policies.properties);

admin.topicPolicies().setSubscriptionTypesEnabledAsync(pulsarTopic, Set.of(SubscriptionType.Shared));

I believe this might be a result of Async policy application on the broker.

Error messages

No error messages are observed. Each  POST call succeeds with a 204.

Reproducing the issue

You can run the two method call orderings and verify the results.

Additional information

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions