diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index 7eacfd73398a..177179170cd5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -3653,7 +3653,9 @@ public ScanResponse scan(final RpcController controller, final ScanRequest reque } quota.addScanResult(results); - quota.addBlockBytesScanned(rpcCall.getBlockBytesScanned()); + if (rpcCall != null) { + quota.addBlockBytesScanned(rpcCall.getBlockBytesScanned()); + } addResults(builder, results, (HBaseRpcController) controller, RegionReplicaUtil.isDefaultReplica(region.getRegionInfo()), isClientCellBlockSupport(rpcCall)); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestBlockBytesScannedQuota.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestBlockBytesScannedQuota.java index 4f47fb6918c2..a8af6b9a1602 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestBlockBytesScannedQuota.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestBlockBytesScannedQuota.java @@ -195,9 +195,9 @@ public void testBBSMultiGet() throws Exception { assertEquals(100, doMultiGets(100, 10, rowCount, FAMILY, QUALIFIER, table)); assertEquals(100, doMultiGets(100, 10, rowCount, FAMILY, QUALIFIER, table)); - // Add 100 block/min limit + // Add ~100 block/min limit admin.setQuota(QuotaSettingsFactory.throttleUser(userName, ThrottleType.REQUEST_SIZE, - Math.round(100 * blockSize), TimeUnit.MINUTES)); + Math.round(100.1 * blockSize), TimeUnit.MINUTES)); triggerUserCacheRefresh(TEST_UTIL, false, TABLE_NAME); // should execute approximately 10 batches of 10 requests