You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by me...@apache.org on 2019/06/03 09:51:07 UTC

[hbase] branch branch-2.2 updated: HBASE-22513 Admin#getQuota does not work correctly if exceedThrottleQuota is set

This is an automated email from the ASF dual-hosted git repository.

meiyi pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 953a795  HBASE-22513 Admin#getQuota does not work correctly if exceedThrottleQuota is set
953a795 is described below

commit 953a795b45a1a7e52003756f8d4279f573b5c997
Author: meiyi <my...@gmail.com>
AuthorDate: Mon Jun 3 16:55:23 2019 +0800

    HBASE-22513 Admin#getQuota does not work correctly if exceedThrottleQuota is set
---
 .../main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java    | 6 ++++++
 .../test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java    | 1 +
 2 files changed, 7 insertions(+)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java
index d8dd50b..a48ce71 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaRetriever.java
@@ -26,6 +26,7 @@ import java.util.Objects;
 import java.util.Queue;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -102,6 +103,11 @@ public class QuotaRetriever implements Closeable, Iterable<QuotaSettings> {
   public QuotaSettings next() throws IOException {
     if (cache.isEmpty()) {
       Result result = scanner.next();
+      // Skip exceedThrottleQuota row key because this is not a QuotaSettings
+      if (result != null
+          && Bytes.equals(result.getRow(), QuotaTableUtil.getExceedThrottleQuotaRowKey())) {
+        result = scanner.next();
+      }
       if (result == null) {
         return null;
       }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java
index 6c5ebdf..0045ec8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaAdmin.java
@@ -636,6 +636,7 @@ public class TestQuotaAdmin {
     assertTrue(admin.exceedThrottleQuotaSwitch(true));
     assertTrue(admin.exceedThrottleQuotaSwitch(false));
     assertFalse(admin.exceedThrottleQuotaSwitch(false));
+    assertEquals(2, admin.getQuota(new QuotaFilter()).size());
     admin.setQuota(QuotaSettingsFactory.unthrottleRegionServer(regionServer));
   }