From e431d84e9ba6fea73f6495ca55e9d2e1b7249430 Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Mon, 7 Oct 2024 16:57:00 +0200 Subject: [PATCH] HBASE-28346: Expose checkQuota to Coprocessor Endpoints (#6066) (addendum) Add default implementations of the new methods so that a custom implementation of RegionCoprocessorEnvironment will not fail to compile after upgrade. --- .../RegionCoprocessorEnvironment.java | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java index 923a719264b2..df94bc01ccbe 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java @@ -135,13 +135,23 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment + * Introduced in 2.6.1. Any custom implementations of this class should implement this method in + * order to take advantage of the new behavior. + *

* @return the RpcQuotaManager */ - RpcQuotaManager getRpcQuotaManager(); + default RpcQuotaManager getRpcQuotaManager() { + throw new UnsupportedOperationException("Not implemented"); + } /** * Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the * available quota and to report the data/usage of the operation. + *

+ * Introduced in 2.6.1. Any custom implementations of this class should implement this method in + * order to take advantage of the new behavior. + *

* @param scan the scan to be estimated against the quota * @param maxBlockBytesScanned the maximum bytes scanned in a single RPC call by the * scanner @@ -150,33 +160,47 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment + * Introduced in 2.6.1. Any custom implementations of this class should implement this method in + * order to take advantage of the new behavior. + *

* @param region the region where the operation will be performed * @param type the operation type * @return the OperationQuota * @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded. */ - OperationQuota checkBatchQuota(final Region region, final OperationQuota.OperationType type) - throws IOException, RpcThrottlingException; + default OperationQuota checkBatchQuota(final Region region, + final OperationQuota.OperationType type) throws IOException, RpcThrottlingException { + throw new UnsupportedOperationException("Not implemented"); + } /** * Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the * available quota and to report the data/usage of the operation. This method does not support * scans because estimating a scan's workload is more complicated than estimating the workload of * a get/put. + *

+ * Introduced in 2.6.1. Any custom implementations of this class should implement this method in + * order to take advantage of the new behavior. + *

* @param region the region where the operation will be performed * @param numWrites number of writes to count against quota * @param numReads number of reads to count against quota * @return the OperationQuota * @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded. */ - OperationQuota checkBatchQuota(final Region region, int numWrites, int numReads) - throws IOException, RpcThrottlingException; + default OperationQuota checkBatchQuota(final Region region, int numWrites, int numReads) + throws IOException, RpcThrottlingException { + throw new UnsupportedOperationException("Not implemented"); + } }