Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improvement][broker]Add replicate all subscription state switch on the broker side. #23769

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,11 @@ acknowledgmentAtBatchIndexLevelEnabled=false
# Enable tracking of replicated subscriptions state across clusters.
enableReplicatedSubscriptions=true

# Whether to replicate all subscription states. If true, it will overwrite the value of
# the replicateSubscriptionState configuration item configured by the client consumer;
# If false, use the value of the client-side replicateSubscriptionState.
replicateAllSubscriptionState=false

# Frequency of snapshots for replicated subscriptions tracking.
replicatedSubscriptionsSnapshotFrequencyMillis=1000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,13 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
doc = "Enable tracking of replicated subscriptions state across clusters.")
private boolean enableReplicatedSubscriptions = true;

@FieldContext(
category = CATEGORY_SERVER,
doc = "Whether to replicate all subscription states. If true, it will overwrite the value of"
+ " the replicateSubscriptionState configuration item configured by the client consumer;"
+ " If false, use the value of the client-side replicateSubscriptionState.")
private boolean replicateAllSubscriptionState = false;

@FieldContext(
category = CATEGORY_SERVER,
doc = "Frequency of snapshots for replicated subscriptions tracking.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,13 @@ private CompletableFuture<Consumer> internalSubscribe(final TransportCnx cnx, St
replicatedSubscriptionState = false;
}

boolean replicateAllSubscriptionState = brokerService.pulsar().getConfiguration()
.isReplicateAllSubscriptionState();
if (replicateAllSubscriptionState
&& brokerService.pulsar().getConfiguration().isEnableReplicatedSubscriptions()) {
replicatedSubscriptionState = true;
}

if (subType == SubType.Key_Shared
&& !brokerService.pulsar().getConfiguration().isSubscriptionKeySharedEnable()) {
return FutureUtil.failedFuture(
Expand Down
Loading