Skip to content

Conversation

@poorbarcode
Copy link
Contributor

Motivation

  • When a topic detects that its cluster policies do not contain the local cluster, the topic will delete itself.
  • This mechanism is designed for the following 3 scenarios

Scenario 1

  • The user has two clusters enabled Geo-Replication with a global metadata store.
    • Namespace-level replicated cluster policy is shared by the global metadata store.
  • The user wants to turn offline a cluster or split clusters by different namespaces, then remove the cluster that he wants to turn offline.
  • The cluster that he wants to turn offline will delete all topics under the namespace.

Scenario 2
Set a topic-level replicated clusters that do not contain local cluster is not meaningful, except the following scenario: User has two clusters, which enabled Geo-Replication through a global metadata store, the resources named partitioned topic metadata and the resource namespace-level "replicated clusters" are shared between multi clusters. Pulsar can hardly delete a specify partitioned topic. To support this use case, the following steps can implement it:

  1. set a global topic-level replicated clusters that do not contain local cluster.
  2. the local cluster will remove the subtopics automatically, and remove the schemas and local topic policies. Just leave the global topic policies there, which prevents the namespace level replicated clusters policy taking affect.

TODO But the API "pulsar-admin topics set-replication-clusters" does not support global policy, to support this scenario, a PIP is needed.

Scenario 3

  • The user has two clusters enabled Geo-Replication with a global metadata store.
  • The user wants to delete topics under a namespace or delete a partitioned topic.
  • The first step he needs to take is to disable Geo-Replication.
    • cluster-A will delete the topics/topic automatically.
  • The user can call pulsar-admin topics delete-partitioned-topic <topic> on cluster-B.

Modifications

  • Since no scenario needs to remove the local cluster from the topic-level replicated cluster policy, deny it.
  • Add test cases
    • Manually modifying topic policies by the Rest API.
      • Global topic-level policies:
        • Add: replicate
        • Update: replicate
        • Delete a single policy(it is equivalent to specifying updating): delete both local and remote policies.
      • Local topic-level policies:
        • Add: never replicate
        • Update: never replicate
        • Delete a single policy(it is equivalent to specifying updating): delete local policies only.
      • Delete Topic triggers that both local and global policies will be deleted in the local cluster, but will not delete the remote cluster's global policies.

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 May 27, 2025
@poorbarcode poorbarcode self-assigned this May 27, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 27, 2025
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@poorbarcode
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

1 similar comment
@poorbarcode
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@poorbarcode poorbarcode force-pushed the fix/global_policies_deleting branch from fecbdfd to 5887b36 Compare June 9, 2025 10:10
@poorbarcode poorbarcode merged commit 82af299 into apache:master Jun 17, 2025
53 checks passed
lhotari pushed a commit that referenced this pull request Jun 19, 2025
lhotari pushed a commit that referenced this pull request Jun 19, 2025
lhotari pushed a commit that referenced this pull request Jun 19, 2025
nodece pushed a commit to nodece/pulsar that referenced this pull request Jun 20, 2025
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 20, 2025
…ated cluster policy (apache#24351)

(cherry picked from commit 82af299)
(cherry picked from commit 7510a76)
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 21, 2025
…ated cluster policy (apache#24351)

(cherry picked from commit 82af299)
(cherry picked from commit e0e4d88)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 24, 2025
…ated cluster policy (apache#24351)

(cherry picked from commit 82af299)
(cherry picked from commit e0e4d88)
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 27, 2025
…ated cluster policy (apache#24351)

(cherry picked from commit 82af299)
(cherry picked from commit 7510a76)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 30, 2025
…ated cluster policy (apache#24351)

(cherry picked from commit 82af299)
(cherry picked from commit 7510a76)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Jul 28, 2025
nodece pushed a commit to nodece/pulsar that referenced this pull request Jul 28, 2025
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
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.

3 participants