This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 4073f49a9cf HBASE-29793 TestDefaultHandlerUsageQuota fails 100% on
flaky dashboard (#7573)
4073f49a9cf is described below
commit 4073f49a9cf13e1a49b5e9d9cfd300d1323e8e7b
Author: Duo Zhang <[email protected]>
AuthorDate: Thu Jan 8 18:52:42 2026 +0800
HBASE-29793 TestDefaultHandlerUsageQuota fails 100% on flaky dashboard
(#7573)
Signed-off-by: Ray Mattingly <[email protected]>
(cherry picked from commit 5bf9614317711957275faf8c509c57dfb60c6fe6)
---
.../hbase/quotas/TestDefaultHandlerUsageQuota.java | 36 ++++++++++++----------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestDefaultHandlerUsageQuota.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestDefaultHandlerUsageQuota.java
index 09e19395c3a..0b1c97c1fa8 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestDefaultHandlerUsageQuota.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestDefaultHandlerUsageQuota.java
@@ -17,10 +17,11 @@
*/
package org.apache.hadoop.hbase.quotas;
+import static
org.apache.hadoop.hbase.quotas.ThrottleQuotaTestUtil.triggerUserCacheRefresh;
+
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
@@ -31,24 +32,21 @@ import
org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
-@Category({ RegionServerTests.class, MediumTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
public class TestDefaultHandlerUsageQuota {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestDefaultHandlerUsageQuota.class);
+
private static final HBaseTestingUtility TEST_UTIL = new
HBaseTestingUtility();
private static final TableName TABLE_NAME =
TableName.valueOf(UUID.randomUUID().toString());
- private static final int REFRESH_TIME = 5;
private static final byte[] FAMILY = Bytes.toBytes("cf");
private static final byte[] QUALIFIER = Bytes.toBytes("q");
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
ThrottleQuotaTestUtil.clearQuotaCache(TEST_UTIL);
EnvironmentEdgeManager.reset();
@@ -56,11 +54,10 @@ public class TestDefaultHandlerUsageQuota {
TEST_UTIL.shutdownMiniCluster();
}
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
// quotas enabled, using block bytes scanned
TEST_UTIL.getConfiguration().setBoolean(QuotaUtil.QUOTA_CONF_KEY, true);
- TEST_UTIL.getConfiguration().setInt(QuotaCache.REFRESH_CONF_KEY,
REFRESH_TIME);
// Set default to very strict
TEST_UTIL.getConfiguration()
.setInt(QuotaUtil.QUOTA_DEFAULT_USER_MACHINE_REQUEST_HANDLER_USAGE_MS,
10);
@@ -73,6 +70,9 @@ public class TestDefaultHandlerUsageQuota {
TEST_UTIL.createTable(TABLE_NAME, FAMILY);
TEST_UTIL.waitTableAvailable(TABLE_NAME);
TEST_UTIL.flush(TABLE_NAME);
+ // increase the tick so we can calculate a positive rpc request time, and
then consume all the
+ // available quota and make request fail next time
+ ThrottleQuotaTestUtil.envEdge.setValue(System.currentTimeMillis() + 1000);
}
@Test
@@ -90,11 +90,13 @@ public class TestDefaultHandlerUsageQuota {
TEST_UTIL.waitFor(60_000, () -> runPutTest(100) < 100);
}
- private void configureLenientThrottle() throws IOException {
+ private void configureLenientThrottle() throws Exception {
try (Admin admin = TEST_UTIL.getAdmin()) {
admin.setQuota(QuotaSettingsFactory.throttleUser(getUserName(),
- ThrottleType.REQUEST_HANDLER_USAGE_MS, 100_000, TimeUnit.SECONDS));
+ ThrottleType.REQUEST_HANDLER_USAGE_MS, 100_000_000, TimeUnit.SECONDS));
}
+ triggerUserCacheRefresh(TEST_UTIL, false, TABLE_NAME);
+ ThrottleQuotaTestUtil.envEdge.setValue(System.currentTimeMillis() + 1000);
}
private static String getUserName() throws IOException {
@@ -105,6 +107,8 @@ public class TestDefaultHandlerUsageQuota {
try (Admin admin = TEST_UTIL.getAdmin()) {
admin.setQuota(QuotaSettingsFactory.unthrottleUser(getUserName()));
}
+ triggerUserCacheRefresh(TEST_UTIL, false, TABLE_NAME);
+ ThrottleQuotaTestUtil.envEdge.setValue(System.currentTimeMillis() + 1000);
}
private long runPutTest(int attempts) throws Exception {