HBASE-13411 Misleading error message when request size quota limit exceeds
Signed-off-by: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
This commit is contained in:
parent
8c707499ba
commit
8c740f4309
|
@ -21,8 +21,6 @@ package org.apache.hadoop.hbase.quotas;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
||||
|
||||
|
@ -38,12 +36,11 @@ import org.apache.hadoop.hbase.classification.InterfaceStability;
|
|||
public class ThrottlingException extends QuotaExceededException {
|
||||
private static final long serialVersionUID = 1406576492085155743L;
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(ThrottlingException.class);
|
||||
|
||||
@InterfaceAudience.Public
|
||||
@InterfaceStability.Evolving
|
||||
public enum Type {
|
||||
NumRequestsExceeded,
|
||||
RequestSizeExceeded,
|
||||
NumReadRequestsExceeded,
|
||||
NumWriteRequestsExceeded,
|
||||
WriteSizeExceeded,
|
||||
|
@ -52,6 +49,7 @@ public class ThrottlingException extends QuotaExceededException {
|
|||
|
||||
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",
|
||||
|
@ -98,6 +96,11 @@ public class ThrottlingException extends QuotaExceededException {
|
|||
throwThrottlingException(Type.NumRequestsExceeded, waitInterval);
|
||||
}
|
||||
|
||||
public static void throwRequestSizeExceeded(final long waitInterval)
|
||||
throws ThrottlingException {
|
||||
throwThrottlingException(Type.RequestSizeExceeded, waitInterval);
|
||||
}
|
||||
|
||||
public static void throwNumReadRequestsExceeded(final long waitInterval)
|
||||
throws ThrottlingException {
|
||||
throwThrottlingException(Type.NumReadRequestsExceeded, waitInterval);
|
||||
|
|
|
@ -19,12 +19,10 @@
|
|||
package org.apache.hadoop.hbase.quotas;
|
||||
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Throttle;
|
||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Throttle;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.TimedQuota;
|
||||
import org.apache.hadoop.hbase.quotas.OperationQuota.AvgOperationSize;
|
||||
import org.apache.hadoop.hbase.quotas.OperationQuota.OperationType;
|
||||
|
@ -36,8 +34,6 @@ import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
|||
@InterfaceAudience.Private
|
||||
@InterfaceStability.Evolving
|
||||
public class TimeBasedLimiter implements QuotaLimiter {
|
||||
private static final Log LOG = LogFactory.getLog(TimeBasedLimiter.class);
|
||||
|
||||
private long writeLastTs = 0;
|
||||
private long readLastTs = 0;
|
||||
|
||||
|
@ -110,7 +106,8 @@ public class TimeBasedLimiter implements QuotaLimiter {
|
|||
ThrottlingException.throwNumRequestsExceeded(reqsLimiter.waitInterval());
|
||||
}
|
||||
if (!reqSizeLimiter.canExecute(now, lastTs, writeSize + readSize)) {
|
||||
ThrottlingException.throwNumRequestsExceeded(reqSizeLimiter.waitInterval(writeSize+readSize));
|
||||
ThrottlingException.throwRequestSizeExceeded(reqSizeLimiter
|
||||
.waitInterval(writeSize + readSize));
|
||||
}
|
||||
|
||||
if (writeSize > 0) {
|
||||
|
|
Loading…
Reference in New Issue