From 3faa67520c7d593c32fbb8112b4978e67e8056cb Mon Sep 17 00:00:00 2001 From: meiyi Date: Fri, 9 Apr 2021 10:23:34 +0800 Subject: [PATCH] HBASE-25747 Remove unused getWriteAvailable method in OperationQuota (#3133) Signed-off-by: stack --- .../hadoop/hbase/quotas/DefaultOperationQuota.java | 11 ----------- .../hadoop/hbase/quotas/ExceedOperationQuota.java | 1 - .../hadoop/hbase/quotas/NoopOperationQuota.java | 5 ----- .../apache/hadoop/hbase/quotas/OperationQuota.java | 3 --- 4 files changed, 20 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/DefaultOperationQuota.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/DefaultOperationQuota.java index 6f0e5cd30a4..d4c2264aab9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/DefaultOperationQuota.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/DefaultOperationQuota.java @@ -24,22 +24,18 @@ import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.client.Result; @InterfaceAudience.Private @InterfaceStability.Evolving public class DefaultOperationQuota implements OperationQuota { - private static final Logger LOG = LoggerFactory.getLogger(DefaultOperationQuota.class); protected final List limiters; private final long writeCapacityUnit; private final long readCapacityUnit; // the available read/write quota size in bytes - protected long writeAvailable = 0; protected long readAvailable = 0; // estimated quota protected long writeConsumed = 0; @@ -81,7 +77,6 @@ public class DefaultOperationQuota implements OperationQuota { public void checkQuota(int numWrites, int numReads, int numScans) throws RpcThrottlingException { updateEstimateConsumeQuota(numWrites, numReads, numScans); - writeAvailable = Long.MAX_VALUE; readAvailable = Long.MAX_VALUE; for (final QuotaLimiter limiter : limiters) { if (limiter.isBypass()) continue; @@ -89,7 +84,6 @@ public class DefaultOperationQuota implements OperationQuota { limiter.checkQuota(numWrites, writeConsumed, numReads + numScans, readConsumed, writeCapacityUnitConsumed, readCapacityUnitConsumed); readAvailable = Math.min(readAvailable, limiter.getReadAvailable()); - writeAvailable = Math.min(writeAvailable, limiter.getWriteAvailable()); } for (final QuotaLimiter limiter : limiters) { @@ -125,11 +119,6 @@ public class DefaultOperationQuota implements OperationQuota { return readAvailable; } - @Override - public long getWriteAvailable() { - return writeAvailable; - } - @Override public void addGetResult(final Result result) { operationSize[OperationType.GET.ordinal()] += QuotaUtil.calculateResultSize(result); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/ExceedOperationQuota.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/ExceedOperationQuota.java index 5c9541e3e2c..6745d3eeb15 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/ExceedOperationQuota.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/ExceedOperationQuota.java @@ -75,7 +75,6 @@ public class ExceedOperationQuota extends DefaultOperationQuota { } // 4. Region server limiter is enough and grab estimated consume quota. readAvailable = Math.max(readAvailable, regionServerLimiter.getReadAvailable()); - writeAvailable = Math.max(writeAvailable, regionServerLimiter.getWriteAvailable()); regionServerLimiter.grabQuota(numWrites, writeConsumed, numReads + numScans, readConsumed, writeCapacityUnitConsumed, writeCapacityUnitConsumed); if (exceed) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NoopOperationQuota.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NoopOperationQuota.java index ca2aa351c1a..81ac3124d14 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NoopOperationQuota.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NoopOperationQuota.java @@ -71,9 +71,4 @@ class NoopOperationQuota implements OperationQuota { public long getReadAvailable() { return Long.MAX_VALUE; } - - @Override - public long getWriteAvailable() { - return Long.MAX_VALUE; - } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/OperationQuota.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/OperationQuota.java index 1863b4c7434..e10a671bb6d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/OperationQuota.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/OperationQuota.java @@ -70,7 +70,4 @@ public interface OperationQuota { /** @return the number of bytes available to read to avoid exceeding the quota */ long getReadAvailable(); - - /** @return the number of bytes available to write to avoid exceeding the quota */ - long getWriteAvailable(); }