You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2018/12/31 12:45:45 UTC

[09/47] hbase git commit: HBASE-21578 Fix wrong throttling exception for capacity unit

HBASE-21578 Fix wrong throttling exception for capacity unit

Signed-off-by: Guanghao Zhang <zg...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1b08ba73
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1b08ba73
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1b08ba73

Branch: refs/heads/HBASE-21512
Commit: 1b08ba7385d0dd914a6fb9722b786e4ece116b28
Parents: 3ff274e
Author: meiyi <my...@gamil.com>
Authored: Fri Dec 14 09:42:48 2018 +0800
Committer: Guanghao Zhang <zg...@apache.org>
Committed: Fri Dec 14 18:17:47 2018 +0800

----------------------------------------------------------------------
 .../hbase/quotas/RpcThrottlingException.java    | 21 ++++++++++++++++++--
 .../hadoop/hbase/quotas/TimeBasedLimiter.java   |  8 ++++----
 2 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1b08ba73/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/RpcThrottlingException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/RpcThrottlingException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/RpcThrottlingException.java
index 9baf91f..4c48f65 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/RpcThrottlingException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/RpcThrottlingException.java
@@ -29,13 +29,15 @@ public class RpcThrottlingException extends HBaseIOException {
   @InterfaceAudience.Public
   public enum Type {
     NumRequestsExceeded, RequestSizeExceeded, NumReadRequestsExceeded, NumWriteRequestsExceeded,
-    WriteSizeExceeded, ReadSizeExceeded,
+    WriteSizeExceeded, ReadSizeExceeded, RequestCapacityUnitExceeded, ReadCapacityUnitExceeded,
+    WriteCapacityUnitExceeded
   }
 
   private static final String[] MSG_TYPE =
       new String[] { "number of requests exceeded", "request size limit exceeded",
         "number of read requests exceeded", "number of write requests exceeded",
-        "write size limit exceeded", "read size limit exceeded", };
+        "write size limit exceeded", "read size limit exceeded", "request capacity unit exceeded",
+        "read capacity unit exceeded", "write capacity unit exceeded" };
 
   private static final String MSG_WAIT = " - wait ";
 
@@ -100,6 +102,21 @@ public class RpcThrottlingException extends HBaseIOException {
     throwThrottlingException(Type.ReadSizeExceeded, waitInterval);
   }
 
+  public static void throwRequestCapacityUnitExceeded(final long waitInterval)
+      throws RpcThrottlingException {
+    throwThrottlingException(Type.RequestCapacityUnitExceeded, waitInterval);
+  }
+
+  public static void throwReadCapacityUnitExceeded(final long waitInterval)
+      throws RpcThrottlingException {
+    throwThrottlingException(Type.ReadCapacityUnitExceeded, waitInterval);
+  }
+
+  public static void throwWriteCapacityUnitExceeded(final long waitInterval)
+      throws RpcThrottlingException {
+    throwThrottlingException(Type.WriteCapacityUnitExceeded, waitInterval);
+  }
+
   private static void throwThrottlingException(final Type type, final long waitInterval)
       throws RpcThrottlingException {
     String msg = MSG_TYPE[type.ordinal()] + MSG_WAIT + StringUtils.formatTime(waitInterval);

http://git-wip-us.apache.org/repos/asf/hbase/blob/1b08ba73/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TimeBasedLimiter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TimeBasedLimiter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TimeBasedLimiter.java
index 771eed1..6b5349f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TimeBasedLimiter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TimeBasedLimiter.java
@@ -148,7 +148,7 @@ public class TimeBasedLimiter implements QuotaLimiter {
           reqSizeLimiter.waitInterval(estimateWriteSize + estimateReadSize));
     }
     if (!reqCapacityUnitLimiter.canExecute(estimateWriteCapacityUnit + estimateReadCapacityUnit)) {
-      RpcThrottlingException.throwRequestSizeExceeded(
+      RpcThrottlingException.throwRequestCapacityUnitExceeded(
         reqCapacityUnitLimiter.waitInterval(estimateWriteCapacityUnit + estimateReadCapacityUnit));
     }
 
@@ -161,7 +161,7 @@ public class TimeBasedLimiter implements QuotaLimiter {
             writeSizeLimiter.waitInterval(estimateWriteSize));
       }
       if (!writeCapacityUnitLimiter.canExecute(estimateWriteCapacityUnit)) {
-        RpcThrottlingException.throwWriteSizeExceeded(
+        RpcThrottlingException.throwWriteCapacityUnitExceeded(
           writeCapacityUnitLimiter.waitInterval(estimateWriteCapacityUnit));
       }
     }
@@ -175,8 +175,8 @@ public class TimeBasedLimiter implements QuotaLimiter {
             readSizeLimiter.waitInterval(estimateReadSize));
       }
       if (!readCapacityUnitLimiter.canExecute(estimateReadCapacityUnit)) {
-        RpcThrottlingException
-            .throwWriteSizeExceeded(readCapacityUnitLimiter.waitInterval(estimateReadCapacityUnit));
+        RpcThrottlingException.throwReadCapacityUnitExceeded(
+          readCapacityUnitLimiter.waitInterval(estimateReadCapacityUnit));
       }
     }
   }