[fix][broker] Fix wrong behaviour when using namespace.allowed_clusters, such as namespace deletion and namespace policies updating #24860
+357
−83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Before PIP-321 Introduce allowed-cluster at the namespace level, Pulsar does not support enabling topic level Geo Replication without enabling namespace level Geo Replication, because the policies
namespace.replication_clusters
has two meanings:PIP-321 Introduce allowed-cluster at the namespace level defined a new policy
namespace.allowed_clusters
, which splits the two definitions.allowed_clusters
is not emptyallowed_clusters
can be used to define which cluster is allowed to access the namespace, if it is set.replication_clusters
defines both statuses.3 Issues
PIP-321 did not complete all the adaptations of codes, such as follows
allowed
bynamespace.allowed_clusters
, the namespace is also unloaded. More importantly, in this case, all brokers will trigger an unloading, which will cause this namespace to remain unavailable for a long time. Every time any policy of the namespace is updated, unload will be triggered again for a round, which will cause the problem to become so serious as to be uncontrollable. The testtestUpdateNamespacePolicies
is used to reproduce the issue.allowed_cluster
is defined as2
clusters are allowed to access. The testtestDeleteNamespaceIfTwoClustersAllowed
is used to reproduce the issue.namespace.allowed_cluster
. The testtestUpdateNamespaceIsolationPolicy
is used to reproduce the issue.Modifications
replication_clusters
andallowed_clusters
anywhere, use a common method to deal with them, including the following checksDocumentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: x