-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix][broker] Ensure existing subscriptions use the initial replication policy #23815
base: master
Are you sure you want to change the base?
[fix][broker] Ensure existing subscriptions use the initial replication policy #23815
Conversation
@nodece Has the behavior always been like this? Just wondering if this is a recent change which would be considered a regression? If not, changing the behavior could be problematic if there are users that rely on this existing behavior. |
@lhotari The PR description has been updated.
Yes, it is always this.
Not.
Usually, the users don't switch the One notice that we should consider the |
Perhaps there should be a warn log for cases where subscription time |
@lhotari This is a good idea. But ultimately, which configuration do we use? |
|
@nodece Wouldn't the goal be to use the persisted state? There's currently no javadoc for pulsar/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerBuilder.java Lines 433 to 437 in 04e89fe
In the javadoc, it could be stated explicitly that it's not possible to change the replicateSubscriptionState by a client for a subscription after it has been created. Perhaps there should be a separate admin operation to change this later? In any case, I think that documenting this change in a new PIP would also be useful for the future. The original PIP-31 doesn't clearly define how replicateSubscriptionState should behave.
|
I think that switching to use the word "initial" instead of "original" in the title and description of this PR could improve the clarity. The reason why I think it's more meaningful is due to the concept "initialSubscriptionPosition" that there is. It would have been a better choice to call the method in the builder |
51c700a
to
c6735a8
Compare
@lhotari The goal is to use the persisted state, which is correct.
This PR has been updated, could you have a chance to review this PR? |
…on policy Signed-off-by: Zixuan Liu <[email protected]>
c6735a8
to
5958587
Compare
Motivation
The subscription replication will be changed if the
org.apache.pulsar.client.api.ConsumerBuilder#replicateSubscriptionState
istrue
:replicateSubscriptionState
isfalse
, indicating that doesn't replicate this subscription.replicateSubscriptionState
istrue
, the subscription will be replication.Because we already store this state with the cursor properties, the existing subscription should use the initial replication policy, this configuration should only affect new subscriptions. Otherwise, the cursor properties are meaningless.
Modifications
org.apache.pulsar.broker.service.persistent.PersistentSubscription
, which will call theorg.apache.pulsar.broker.service.persistent.PersistentSubscription#setReplicated
, so we can remove flip the subscription state logic.replicateSubscriptionState
javadoc.Documentation
doc
doc-required
doc-not-needed
doc-complete