-
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
PIP-245: Make subscriptions of NonPersistentTopic non-durable #19448
Comments
Discuss thread: https://lists.apache.org/thread/2ltmyglnb25jy8nk58twkwbglws43bst |
The default subscription mode is durable. So users will see the warning log if they upgrade to the new version client? Why not just change |
Yes
Because |
The issue had no activity for 30 days, mark with Stale label. |
Motivation
There are two types of subscriptions for a topic:
Durable
andNon-durable
.We create a
Consumer
with aDurable
subscription and aReader
with aNon-durable
subscription.But for
NonPersistentTopic
, creating aDurable
subscription is meaningless,NonPersistentSubscription
doesn't have aManagedCursor
to persistent its data. After its consumer disconnected, the subscription couldn't be removed automatically if we didn't set the value ofsubscriptionExpirationTimeMinutes
greater than 0.For
subscriptionExpirationTimeMinutes
, it controls the subscription expiration ofNonPersistentTopic
andPersistentTopic
, if we set the value ofsubscriptionExpirationTimeMinutes
greater than 0, it may lead to data loss(The durable subscriptions of PersistentTopic also can be removed).And the Non-durable subscriptions will be removed automatically after all the consumers disconnected, it's the existing logic.
For the purpose of removing the subscriptions which have no active consumers of
NonPersistentTopic
and the above reasons, we can make all the subscriptions of a NonPersistentTopicNon-durable
.Goal
Make the subscriptions of NonPersistentTopic
Non-durable
.API Changes
Implementation
1. Client-side:
Add the following logic to the constructor of
ConsumerImpl
before this.subscriptionMode=conf.getSubscriptionMode():Check the topic type, if the topic is a NonPersistentTopic, change the value of
subscriptionMode
toNonDurable
and print WARN log, Users don't need to change their code.2. Broker-side:
Change the constructor of NonPersistentTopic from
to
Remove the constructor argument
isDurable
, and set its value tofalse
.Compatibility
The PIP will deprecate
Durable
subscriptions onNonPersistentTopic
in 3.0.0, if users want to create aDurable
subscription onNonPersistentTopic
we will print WARN logs and changeisDurable
tofalse
.We will not be compatible with the next version after 3.0.1.
In the next release after 3.0.0, if users want to create
Durable
subscriptions onNonPersistentTopic
, will throw an exception.Alternatives
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: