Add configurable periodic refresh of throughput-violating topics cache#1042
Merged
harshOSS merged 1 commit intoJul 9, 2026
Conversation
The coordinator's host-level throughput-violating topics cache was only rebuilt on assignment and datastream-update events, so between rebalances it could remain stale for a long time. This adds a periodic rebuild from the current assignment so cache freshness is bounded by a configurable interval regardless of rebalance timing, and makes the behavior fully config-driven: - brooklin.server.coordinator.throughputViolatingTopicsRefreshPeriodMs (default 5 minutes): the refresh interval. - brooklin.server.coordinator.enableThroughputViolatingTopicsPeriodicRefresh (default true): a dedicated on/off toggle, additionally gated by the existing enableThroughputViolatingTopicsHandling feature flag. Also in this change: - onAssignmentChange now rebuilds the cache before queuing the async task-start event (matching onDatastreamUpdate) so a newly started producer cannot emit before its topic is present in the map. - The shared rebuild path logs a WARN when an assigned task cannot be resolved and is dropped, or when a non-empty assignment yields an empty/partial rebuild, so silent partial rebuilds become detectable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
harshOSS
force-pushed
the
hmadhav/coordinator-throughput-violating-topics-periodic-refresh
branch
from
July 7, 2026 20:32
7d80803 to
b6347be
Compare
| // it so partial rebuilds are detectable. A non-empty assignment that yields no datastream groups | ||
| // would clear the cache to empty, so we WARN on that too. | ||
| private void refreshThroughputViolatingTopicsMap(String trigger) { | ||
| List<String> assignment = _adapter.getInstanceAssignment(_adapter.getInstanceName()); |
Collaborator
There was a problem hiding this comment.
will this be updated with the latest assignment or older assignment?
Can we just decouple the violating topics map from the assignments itself? Basically all throughout violating topics updated in the cache irrespective of whether or not they are assigned to the node?
Collaborator
Author
There was a problem hiding this comment.
will this be updated with the latest assignment or older assignment?
- this will be always the latest assignment present in Zookeeper .
Can we just decouple the violating topics map from the assignments itself? Basically all throughout violating topics updated in the cache irrespective of whether or not they are assigned to the node?
- IMO , we should not do this as on small cluster it will not be an issue but on large cluster it will be unncessary parsing of all assignments across the cluster (assignment can go upto 1k or even more) , so it will result in additional network call without any benefits.
kanishkjaiswal2015
approved these changes
Jul 8, 2026
khandelwal-ayush
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The coordinator's host-level throughput-violating topics cache was only rebuilt on assignment and datastream-update events, so between rebalances it could remain stale for a long time. This change adds a periodic rebuild from the current assignment so cache freshness is bounded by a configurable interval regardless of rebalance timing, and makes the behavior fully config-driven:
brooklin.server.coordinator.throughputViolatingTopicsRefreshPeriodMs(default 5 minutes) — the refresh interval.brooklin.server.coordinator.enableThroughputViolatingTopicsPeriodicRefresh(defaulttrue) — a dedicated on/off toggle, additionally gated by the existingenableThroughputViolatingTopicsHandlingfeature flag.Additional hardening in the same code path:
onAssignmentChangenow rebuilds the cache before queuing the async task-start event (matchingonDatastreamUpdate), so a newly started producer cannot emit before its topic is present in the map.WARNwhen an assigned task cannot be resolved and is dropped, or when a non-empty assignment yields an empty/partial rebuild, so silent partial rebuilds become detectable.Testing Done
Added and ran (JDK 17, Gradle 7.6.4):
TestCoordinatorConfig#testThroughputViolatingTopicsRefreshPeriodConfig,#testEnableThroughputViolatingTopicsPeriodicRefreshConfigTestCoordinator#testThroughputViolatingTopicsPeriodicRefreshRebuildsStaleMap,#testThroughputViolatingTopicsPeriodicRefreshEnablementGatingTestCoordinatortests still pass;checkstyleMain/checkstyleTestare clean fordatastream-serveranddatastream-server-restli.🤖 Generated with GitHub Copilot CLI