-
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
[Issue 5927][Pulsar Client] Change the time unit of `patternAutoDiscoveryPeriod to seconds #5950
[Issue 5927][Pulsar Client] Change the time unit of `patternAutoDiscoveryPeriod to seconds #5950
Conversation
…veryPeriod` to SECONDS
retest this please |
retest this please |
run java8 tests |
The reason for limit the min refresh to 1 min is to avoid clients creating unnecessary load to brokers with a custom configuration. If you set 10ms, it could create a lot of requests and significant load if the number of topics is not trivial. Of course, the proper solution would be to have the broker notifying clients whenever there are new topics. |
understood, my update will ensure the min interval is 1 second, which might still be too short. agree with you, [the broker notifying clients] will be the final great solution. |
I think this change doesn’t change the default value. This provides the mechanism for applications to configure this in a finer granularity as people want reduce this to a few seconds. |
run java8 tests |
2 similar comments
run java8 tests |
run java8 tests |
+1 I was just about to submit my own PR that changes
I agree, and if this is actually realistic (I have not seen enough of the pulsar code base yet to make that call) I would even volunteer to implement this, because it is something that I would like to have, as the use case I have started to play with has tens of thousands of topics in a single namespace, i.e. all these topics are subject to multi-topic pattern subscription. And for that, a push notification for topic additions and removals would seem much more lightweight than having to pull, say, 20 thousand topic names every second or so, even when there aren't (m)any changes. |
…veryPeriod` to SECONDS (apache#5950) Fixes apache#5927 ### Motivation Per apache#5927, by adding one overload to configure patternAutoDiscoveryPeriod by time units, users may be able to configure the time duration to be less than 1 minute. ### Modifications 1. Add an overload of `ConsumerBuilder.patternAutoDiscoveryPeriod` 2. Update original `ConsumerBuilderImpl.patternAutoDiscoveryPeriod` to call the new overload 3. Update the `PatternMultiTopicsConsumerImpl.recheckPatternTimeout` logic, this should be carefully reviewed, since I don't understand the original logic, it seems the old implementation will only allow 0 or 1 minute as the recheck interval, ignoring the user's periods which longer than 1 minute ### Verifying this change - Add the unit test to verify param invalidness - Update one unit test in `PatternTopicsConsumerImplTest.testAutoUnbubscribePatternConsumer` to use 10 seconds period (if another new test is requested per review i will add it later)
Fixes #5927
Motivation
Per #5927, by adding one overload to configure patternAutoDiscoveryPeriod by time units, users may be able to configure the time duration to be less than 1 minute.
Modifications
ConsumerBuilder.patternAutoDiscoveryPeriod
ConsumerBuilderImpl.patternAutoDiscoveryPeriod
to call the new overloadPatternMultiTopicsConsumerImpl.recheckPatternTimeout
logic, this should be carefully reviewed, since I don't understand the original logic, it seems the old implementation will only allow 0 or 1 minute as the recheck interval, ignoring the user's periods which longer than 1 minuteVerifying this change
PatternTopicsConsumerImplTest.testAutoUnbubscribePatternConsumer
to use 10 seconds period(if another new test is requested per review i will add it later)
Does this pull request potentially affect one of the following parts:
Documentation
Future Discussion
patternAutoDiscoveryPeriod(interval,unit)
may have more meaningful semantic, will there be any plan to deprecate the old method?