[fix][broker] Reject replicated subscriptions on non-replicated topics - #26262
[fix][broker] Reject replicated subscriptions on non-replicated topics#26262Praveenkumar76 wants to merge 1 commit into
Conversation
|
This would cause a breaking change. In some usecases, it might be convenient to first create topics with replicated subscriptions and only after that enable replication. Instead of making code changes, the issue could be resolved by adding clarification in documentation that replicated subscriptions won't have effect unless replication is enabled. There are also other limitations in replicated subscriptions and that's why I don't think that there's a need to prevent creating subscriptions when replication isn't enabled. The current documentation: https://pulsar.apache.org/docs/5.0.x/administration-geo/#replicated-subscriptions It does already mention that 2-way replication is required for replicated subscriptions. Configuring 1-way replication isn't sufficient, so the check in this PR wouldn't be useful since the condition is more strict. |
|
It would be useful to reject creating replicated subscription if the feature is disabled in the broker. however |
Fixes #24090
Motivation
Pulsar currently allows a replicated subscription to be created or enabled even when the topic itself is not replicated across multiple clusters.
In this situation, the subscription is marked as replicated on the local cluster, but there is no remote topic or subscription to receive the replicated subscription state. This creates a misleading configuration where replicated subscriptions appear enabled but cannot function.
Modifications
setReplicatedSubscriptionStatus.Verifying this change
This change added tests and can be verified as follows:
ReplicatedSubscriptionConfigTest.rejectReplicatedSubscriptionWithoutTopicReplicationto verify that consumer-based replicated-subscription creation is rejected on a non-replicated topic.PersistentTopicsTest.testCannotEnableReplicatedSubscriptionWithoutTopicReplicationto verify that the admin API rejects enabling replicated subscription status on a non-replicated topic.The following targeted tests passed locally:
Does this pull request potentially affect one of the following parts:
The replicated-subscription status REST endpoint now returns a precondition failure when enabling replication for a subscription whose topic is not replicated across multiple clusters.