Add config to set consumption rate limit at partition level#18904
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new realtime stream config (partition.consumption.rate.limit) to support setting consumption throttling directly at the partition level (so it doesn’t need recalculation when topic partition counts change), and updates the rate limiter creation path to prefer this partition-level limit over the existing topic-level limit.
Changes:
- Add
partition.consumption.rate.limitstream config key and plumb it throughStreamConfig+RealtimeConsumptionRateManager. - Change
StreamConfigconsumption rate limit getters fromOptional<Double>to primitivedouble(non-positive = disabled), and remove some legacy/dead stream config members. - Update
RealtimeConsumptionRateManagerTestto cover the new precedence behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pinot-spi/src/main/java/org/apache/pinot/spi/stream/StreamConfigProperties.java | Adds the new partition-level rate limit key; removes legacy constants. |
| pinot-spi/src/main/java/org/apache/pinot/spi/stream/StreamConfig.java | Stores/returns partition-level + topic-level rate limits and updates public API surface (getter signature changes). |
| pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeConsumptionRateManager.java | Prefers partition-level limit and skips partition-count cache when present. |
| pinot-core/src/test/java/org/apache/pinot/core/data/manager/realtime/RealtimeConsumptionRateManagerTest.java | Updates tests for the new rate limit precedence behavior. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18904 +/- ##
=========================================
Coverage 64.80% 64.80%
Complexity 1347 1347
=========================================
Files 3393 3393
Lines 211666 211676 +10
Branches 33305 33312 +7
=========================================
+ Hits 137164 137182 +18
+ Misses 63431 63419 -12
- Partials 11071 11075 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Add a new stream config
partition.consumption.rate.limitto set the realtime consumption rate limit directly at partition level. Unlike the existingtopic.consumption.rate.limit(which is divided by the topic's partition count), the partition level limit doesn't need to be reconfigured when the partition count changes.RealtimeConsumptionRateManager.createRateLimiterchecks the partition level limit first and uses it directly, skipping the partition count fetch (and its cache) entirely. When both are specified, partition level limit takes precedence. Topic level behavior is unchanged.StreamConfignow return primitivedouble(non-positive means not throttled) instead ofOptional<Double>, consistent with other configs.CONSUMPTION_RATE_LIMIT_NOT_SPECIFIEDis made public._groupId/getGroupId()fromStreamConfigand the unusedGROUP_ID(hlc.group.id, HLC legacy) andPARTITION_MSG_OFFSET_FACTORY_CLASSkeys fromStreamConfigProperties; reorderedequals/hashCode/toStringto match field declaration order and fixed two malformedtoStringlabels (missing=,_offSettypo).Note:
getTopicConsumptionRateLimit()signature change and the removed dead members are binary-incompatible for third-party plugins compiled againstpinot-spi. There are no callers in the Pinot codebase.