Skip to content

Conversation

@rmdmattingly
Copy link
Contributor

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

Comment on lines +661 to +663
for (ThrottleType throttleType : ThrottleType.values()) {
canSetAndGetUserThrottle(throttleType);
}
Copy link
Contributor Author

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

Copy link

Copilot AI left a 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));

Comment on lines 170 to +178
}
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()));
}
Copy link

Copilot AI Apr 30, 2025

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.

Suggested change
}
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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 35s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ master Compile Tests _
+0 🆗 mvndep 0m 18s Maven dependency ordering for branch
+1 💚 mvninstall 6m 37s master passed
+1 💚 compile 7m 15s master passed
+1 💚 checkstyle 1m 56s master passed
+1 💚 spotbugs 4m 52s master passed
+1 💚 spotless 1m 35s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 22s Maven dependency ordering for patch
+1 💚 mvninstall 6m 29s the patch passed
+1 💚 compile 6m 53s the patch passed
+1 💚 javac 6m 53s the patch passed
+1 💚 blanks 0m 1s The patch has no blanks issues.
+1 💚 checkstyle 1m 56s the patch passed
+1 💚 spotbugs 5m 23s the patch passed
+1 💚 hadoopcheck 20m 36s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 1m 40s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 50s The patch does not generate ASF License warnings.
80m 20s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6953/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6953
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux 98c72d26f586 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / ec1aa84
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-client hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6953/1/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 52s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗 mvndep 0m 13s Maven dependency ordering for branch
+1 💚 mvninstall 4m 43s master passed
+1 💚 compile 2m 2s master passed
+1 💚 javadoc 1m 8s master passed
+1 💚 shadedjars 7m 58s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 13s Maven dependency ordering for patch
+1 💚 mvninstall 4m 22s the patch passed
+1 💚 compile 1m 45s the patch passed
+1 💚 javac 1m 45s the patch passed
+1 💚 javadoc 1m 2s the patch passed
+1 💚 shadedjars 7m 58s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 2m 1s hbase-client in the patch passed.
+1 💚 unit 221m 53s hbase-server in the patch passed.
260m 53s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6953/1/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6953
Optional Tests javac javadoc unit compile shadedjars
uname Linux 1ee895875e17 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / ec1aa84
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6953/1/testReport/
Max. process+thread count 5960 (vs. ulimit of 30000)
modules C: hbase-client hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6953/1/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@rmdmattingly rmdmattingly merged commit 9e19120 into apache:master May 1, 2025
1 check passed
@rmdmattingly rmdmattingly deleted the HBASE-29281 branch May 1, 2025 12:03
rmdmattingly added a commit that referenced this pull request May 1, 2025
… support (#6953)

Co-authored-by: Ray Mattingly <[email protected]>
Signed-off-by: Nick Dimiduk <[email protected]>
rmdmattingly added a commit that referenced this pull request May 1, 2025
… support (#6953)

Co-authored-by: Ray Mattingly <[email protected]>
Signed-off-by: Nick Dimiduk <[email protected]>
rmdmattingly added a commit that referenced this pull request May 1, 2025
… support (#6953)

Co-authored-by: Ray Mattingly <[email protected]>
Signed-off-by: Nick Dimiduk <[email protected]>
rmdmattingly added a commit that referenced this pull request May 2, 2025
… support (#6953) (#6956)

Signed-off-by: Nick Dimiduk <[email protected]>
Co-authored-by: Ray Mattingly <[email protected]>
rmdmattingly added a commit that referenced this pull request May 2, 2025
… support (#6953) (#6957)

Signed-off-by: Nick Dimiduk <[email protected]>
Co-authored-by: Ray Mattingly <[email protected]>
rmdmattingly added a commit that referenced this pull request May 2, 2025
… support (#6953) (#6958)

Signed-off-by: Nick Dimiduk <[email protected]>
Co-authored-by: Ray Mattingly <[email protected]>
mokai87 pushed a commit to mokai87/hbase that referenced this pull request Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants