Skip to content

Commit 7ffba05

Browse files
committed
HBASE-28346: Expose checkQuota to Coprocessor Endpoints (#6066) (addendum) (#6350)
Add default implementations of the new methods so that a custom implementation of RegionCoprocessorEnvironment will not fail to compile after upgrade. Signed-off-by: Nihal Jain <nihaljain@apache.org>
1 parent 50e269e commit 7ffba05

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,23 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment<Reg
135135
/**
136136
* Returns an RpcQuotaManager that can be used to apply quota checks against the workloads
137137
* generated by the coprocessor.
138+
* <p>
139+
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
140+
* order to take advantage of the new behavior.
141+
* </p>
138142
* @return the RpcQuotaManager
139143
*/
140-
RpcQuotaManager getRpcQuotaManager();
144+
default RpcQuotaManager getRpcQuotaManager() {
145+
throw new UnsupportedOperationException("Not implemented");
146+
}
141147

142148
/**
143149
* Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the
144150
* available quota and to report the data/usage of the operation.
151+
* <p>
152+
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
153+
* order to take advantage of the new behavior.
154+
* </p>
145155
* @param scan the scan to be estimated against the quota
146156
* @param maxBlockBytesScanned the maximum bytes scanned in a single RPC call by the
147157
* scanner
@@ -150,33 +160,47 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment<Reg
150160
* @return the OperationQuota
151161
* @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded.
152162
*/
153-
OperationQuota checkScanQuota(Scan scan, long maxBlockBytesScanned,
154-
long prevBlockBytesScannedDifference) throws IOException, RpcThrottlingException;
163+
default OperationQuota checkScanQuota(Scan scan, long maxBlockBytesScanned,
164+
long prevBlockBytesScannedDifference) throws IOException, RpcThrottlingException {
165+
throw new UnsupportedOperationException("Not implemented");
166+
}
155167

156168
/**
157169
* Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the
158170
* available quota and to report the data/usage of the operation. This method does not support
159171
* scans because estimating a scan's workload is more complicated than estimating the workload of
160172
* a get/put.
173+
* <p>
174+
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
175+
* order to take advantage of the new behavior.
176+
* </p>
161177
* @param region the region where the operation will be performed
162178
* @param type the operation type
163179
* @return the OperationQuota
164180
* @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded.
165181
*/
166-
OperationQuota checkBatchQuota(final Region region, final OperationQuota.OperationType type)
167-
throws IOException, RpcThrottlingException;
182+
default OperationQuota checkBatchQuota(final Region region,
183+
final OperationQuota.OperationType type) throws IOException, RpcThrottlingException {
184+
throw new UnsupportedOperationException("Not implemented");
185+
}
168186

169187
/**
170188
* Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the
171189
* available quota and to report the data/usage of the operation. This method does not support
172190
* scans because estimating a scan's workload is more complicated than estimating the workload of
173191
* a get/put.
192+
* <p>
193+
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
194+
* order to take advantage of the new behavior.
195+
* </p>
174196
* @param region the region where the operation will be performed
175197
* @param numWrites number of writes to count against quota
176198
* @param numReads number of reads to count against quota
177199
* @return the OperationQuota
178200
* @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded.
179201
*/
180-
OperationQuota checkBatchQuota(final Region region, int numWrites, int numReads)
181-
throws IOException, RpcThrottlingException;
202+
default OperationQuota checkBatchQuota(final Region region, int numWrites, int numReads)
203+
throws IOException, RpcThrottlingException {
204+
throw new UnsupportedOperationException("Not implemented");
205+
}
182206
}

0 commit comments

Comments
 (0)