-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-27687: support consumption of block bytes scanned in operation quota
#5654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2c083b7
31a7882
e7c8a05
433a699
7f660d4
c36ab49
d167196
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -690,6 +690,7 @@ private Result increment(final HRegion region, final OperationQuota quota, | |
| if (metricsRegionServer != null) { | ||
| long blockBytesScanned = | ||
| context != null ? context.getBlockBytesScanned() - blockBytesScannedBefore : 0; | ||
| quota.addBlockBytesScanned(blockBytesScanned); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this may not be a huge issue, but i think this shouldn't be within the metricsRegionServer != null check. Maybe move this and the above line up outside
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also you missed adding this to |
||
| metricsRegionServer.updateIncrement(region, EnvironmentEdgeManager.currentTime() - before, | ||
| blockBytesScanned); | ||
| } | ||
|
|
@@ -2506,6 +2507,9 @@ public GetResponse get(final RpcController controller, final GetRequest request) | |
| if (r != null && r.rawCells() != null) { | ||
| quota.addGetResult(r); | ||
| } | ||
| if (context != null) { | ||
| quota.addBlockBytesScanned(context.getBlockBytesScanned()); | ||
| } | ||
| return builder.build(); | ||
| } catch (IOException ie) { | ||
| throw new ServiceException(ie); | ||
|
|
@@ -2841,6 +2845,9 @@ public MultiResponse multi(final RpcController rpcc, final MultiRequest request) | |
| spaceQuotaEnforcement); | ||
| } | ||
| } finally { | ||
| if (context != null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think this works out so well, because of how some of the methods are abstracted. For example, I might recommend only adding calls to addBlockBytesScanned wherever there are existing calls to getBlockBytesScanned() for metrics. As I mentioned in another comment, you'll want to move the getBlockBytesScanned() outside the if (metrics != null) checks, but otherwise those are probably the best places to add the quota calls if possible.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm actually maybe it's better to keep this here and to instead handle avoiding double counting append/increment, i.e. by passing in a isMulti boolean or something |
||
| quota.addBlockBytesScanned(context.getBlockBytesScanned()); | ||
| } | ||
| quota.close(); | ||
| } | ||
|
|
||
|
|
@@ -3041,6 +3048,7 @@ private CheckAndMutateResult checkAndMutate(HRegion region, OperationQuota quota | |
| long after = EnvironmentEdgeManager.currentTime(); | ||
| long blockBytesScanned = | ||
| context != null ? context.getBlockBytesScanned() - blockBytesScannedBefore : 0; | ||
| quota.addBlockBytesScanned(blockBytesScanned); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| metricsRegionServer.updateCheckAndMutate(region, after - before, blockBytesScanned); | ||
|
|
||
| MutationType type = mutation.getMutateType(); | ||
|
|
@@ -3645,6 +3653,7 @@ public ScanResponse scan(final RpcController controller, final ScanRequest reque | |
| } | ||
|
|
||
| quota.addScanResult(results); | ||
| quota.addBlockBytesScanned(rpcCall.getBlockBytesScanned()); | ||
| addResults(builder, results, (HBaseRpcController) controller, | ||
| RegionReplicaUtil.isDefaultReplica(region.getRegionInfo()), | ||
| isClientCellBlockSupport(rpcCall)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a nit, but can you move the writeConsumed out of the if blocks so we don't duplicate?