-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29281 Atomic request throttles are missing QuotaSettingsFactory support #6953
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
Conversation
| for (ThrottleType throttleType : ThrottleType.values()) { | ||
| canSetAndGetUserThrottle(throttleType); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By validating this for every throttle type, we'll prevent new throttle types from missing this key usability piece down the road
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses the missing support for atomic throttle settings in the QuotaSettingsFactory and adds tests to validate that all throttle types—including the new atomic ones—are handled correctly.
- Updated QuotaSettingsFactory.java to process atomic read size, write size, and request number throttles.
- Added a new test method in TestQuotaThrottle.java to iterate over all throttle types and verify that the quota settings are applied and subsequently removed.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java | Added tests to verify correct setting and removal of all throttle types. |
| hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java | Extended throttle settings construction to include atomic throttle support. |
Comments suppressed due to low confidence (1)
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaThrottle.java:690
- Consider asserting that the quota for the given throttleType has been successfully removed after unthrottling, to enhance test coverage and validate the unthrottling behavior.
admin.setQuota(QuotaSettingsFactory.unthrottleUserByThrottleType(userName, throttleType));
| } | ||
| if (throttle.hasAtomicReadSize()) { | ||
| settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, | ||
| ThrottleType.ATOMIC_READ_SIZE, throttle.getAtomicReadSize())); | ||
| } | ||
| if (throttle.hasAtomicWriteSize()) { | ||
| settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, | ||
| ThrottleType.ATOMIC_WRITE_SIZE, throttle.getAtomicWriteSize())); | ||
| } |
Copilot
AI
Apr 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding an inline comment here (and similarly for atomic write and request numbers) to explain the purpose of handling these atomic throttle settings for improved maintainability.
| } | |
| if (throttle.hasAtomicReadSize()) { | |
| settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, | |
| ThrottleType.ATOMIC_READ_SIZE, throttle.getAtomicReadSize())); | |
| } | |
| if (throttle.hasAtomicWriteSize()) { | |
| settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, | |
| ThrottleType.ATOMIC_WRITE_SIZE, throttle.getAtomicWriteSize())); | |
| } | |
| } | |
| // Handle atomic read size throttling: This enforces limits on the size of read operations | |
| // at an atomic level, ensuring precise control over resource usage. | |
| if (throttle.hasAtomicReadSize()) { | |
| settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, | |
| ThrottleType.ATOMIC_READ_SIZE, throttle.getAtomicReadSize())); | |
| } | |
| // Handle atomic write size throttling: This enforces limits on the size of write operations | |
| // at an atomic level, ensuring precise control over resource usage. | |
| if (throttle.hasAtomicWriteSize()) { | |
| settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer, | |
| ThrottleType.ATOMIC_WRITE_SIZE, throttle.getAtomicWriteSize())); | |
| } | |
| // Handle atomic request number throttling: This enforces limits on the number of requests | |
| // at an atomic level, ensuring precise control over resource usage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm against superfluous comments that just reiterate straightforward code. This is already too verbose
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
… support (#6953) Co-authored-by: Ray Mattingly <[email protected]> Signed-off-by: Nick Dimiduk <[email protected]>
… support (#6953) Co-authored-by: Ray Mattingly <[email protected]> Signed-off-by: Nick Dimiduk <[email protected]>
… support (#6953) Co-authored-by: Ray Mattingly <[email protected]> Signed-off-by: Nick Dimiduk <[email protected]>
… support (#6953) (#6956) Signed-off-by: Nick Dimiduk <[email protected]> Co-authored-by: Ray Mattingly <[email protected]>
… support (#6953) (#6957) Signed-off-by: Nick Dimiduk <[email protected]> Co-authored-by: Ray Mattingly <[email protected]>
… support (#6953) (#6958) Signed-off-by: Nick Dimiduk <[email protected]> Co-authored-by: Ray Mattingly <[email protected]>
… support (apache#6953) (apache#6957) Signed-off-by: Nick Dimiduk <[email protected]> Co-authored-by: Ray Mattingly <[email protected]>
While rolling out atomic throttles at my day job, I realized that we're unable to fetch our atomic throttle settings. This is because, in https://issues.apache.org/jira/browse/HBASE-29229, I forgot to wire up atomic throttles in the QuotaSettingsFactory.
I've also added a test that will make it much harder to make this same mistake down the road