@@ -27,15 +27,11 @@ to the broker, namespace and topic levels, the system reduces the need for expli
27
27
The PIP aims to provide management of subscription replication at the broker, namespace and topic levels using the
28
28
Pulsar Admin CLI and API.
29
29
30
- # Out scope
31
-
32
- This feature depends on https://github.com/apache/pulsar/pull/23757 , which makes the subscription replication nullable
33
- on the consumer level. Otherwise, the broker, namespace and topic levels will be ignored.
34
-
35
30
# High Level Design
36
31
37
32
Introduces a configuration used for enabling subscription replication on the broker, namespace and topic levels, when
38
- enabled, all consumers under the topic will automatically replicate their subscription states to remote clusters.
33
+ enabled, all consumers under the broker/namespace/topic will automatically replicate their subscription states to remote
34
+ clusters.
39
35
40
36
The priority for the subscription replication configuration is as follows:
41
37
@@ -108,39 +104,25 @@ public class ServiceConfiguration implements PulsarConfiguration {
108
104
109
105
### Consumer level
110
106
111
- We currently support the ` replicateSubscriptionState ` flag for new subscription at the consumer level, which can be set
112
- to ` true ` or ` false ` . If ` true ` , we persist ` pulsar.replicated.subscription=1L ` to the cursor properties, and if
113
- ` false ` , we remove that.
114
-
115
- To keep the consumer-level configuration, we need to consider the ` false ` case, so propose using
116
- ` pulsar.replicated.subscription=0L ` instead of removing the property.
117
-
118
- The consumer-level configuration takes precedence over both the topic, broker and namespace levels, ensuring that
119
- consumer-specific configurations can still override the more general settings.
107
+ No changes. When the consumer with ` replicateSubscriptionState=true ` , the old/new subscription will be snapshot. If ` false ` , no operation will
108
+ be performed.
120
109
121
110
### Subscription replication applied
122
111
123
112
When the subscription replication is changed on the broker, namespace or topic level, the subscription replication will
124
- be applied to all consumers under the topic.
113
+ be applied to all consumers under the broker/namespace/ topic.
125
114
126
- Please notice that the ` org.apache.pulsar.client.admin.Topics.setReplicatedSubscriptionStatus() ` can override the
127
- subscription replication configuration for the special subscription, and equals the consumer level.
115
+ We exclusively consider the ` true ` case for replication. If the consumer level is set to ` false ` , the
116
+ replication configuration defined at the topic, namespace, or broker level will be applied to the subscription.
117
+
118
+ There is a special case here, if the user intentionally sets ` false ` at the consumer level, and then set ` true ` at the
119
+ topic/ns/broker level, this may disrupt the user's behavior. This way, we can minimize changes to the Pulsar public API
120
+ as much as possible.
128
121
129
122
## Public-facing Changes
130
123
131
124
### Public API
132
125
133
- ### Client API
134
-
135
- Change the set replicated subscription status method in the ` org.apache.pulsar.client.admin.Topics ` interface to accept the ` Boolean ` type:
136
-
137
- ``` java
138
- void setReplicatedSubscriptionStatus(String topic, String subName, Boolean enabled) throws PulsarAdminException ;
139
- CompletableFuture<Void > setReplicatedSubscriptionStatusAsync(String topic, String subName, Boolean enabled);
140
- ```
141
-
142
- #### REST API
143
-
144
126
##### Namespace level
145
127
146
128
- ` /{tenant}/{namespace}/replicateSubscriptionState ` : enable/disable/remove the subscription replication on the
@@ -203,10 +185,6 @@ CompletableFuture<Void> setReplicatedSubscriptionStatusAsync(String topic, Strin
203
185
subscription replication configuration on the topic level.
204
186
- ` pulsar-admin topicPolicies remove-replicate-subscription-state <tenant>/<namespace>/<topic> ` to remove the
205
187
subscription replication configuration on the topic level.
206
- - ` pulsar-admin topicPolicies remove-replicate-subscription-state <tenant>/<namespace>/<topic> ` to remove the
207
- subscription replication configuration on the topic level.
208
- - ` pulsar-admin topics remove-replicated-subscription-status <tenant>/<namespace>/<topic> ` to remove the
209
- subscription replication configuration on the consumer(subscription) level.
210
188
211
189
# Security Considerations
212
190
@@ -230,20 +208,7 @@ Both write and read operations require the necessary permissions, which already
230
208
231
209
## Upgrade
232
210
233
- Because the consumer's ` replicateSubscriptionSate=false ` does not persist to the cursor properties, it leads to
234
- compatibility issues:
235
-
236
- - When the existing subscription with ` replicateSubscriptionSate=false ` on the consumer level, which uses the policy
237
- from the topic, namespace, or broker level. If you want to use the initial configuration, please use the pulsar-admin
238
- API orCLI:
239
- - CLI
240
- ``` shell
241
- bin/pulsar-admin topics set-replicated-subscription-status < tenant> /< namespace> /< topic> -s < subName> --disable
242
- ```
243
- - API
244
- ` ` ` java
245
- admin.topics ().setReplicatedSubscriptionStatus(topic, subName, false);
246
- ` ` `
211
+ None.
247
212
248
213
## Downgrade / Rollback
249
214
0 commit comments