Update setQuota function in QuotaCommand.actor.cpp to round up to nearest page size

This commit is contained in:
sfc-gh-tclinkenbeard 2022-09-27 09:48:42 -07:00
parent 4d9d0afe01
commit 16fe88948e
2 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ fdbcli> quota set <tag> [reserved_throughput|total_throughput] <bytes_per_second
Note that the quotas are specified in terms of bytes/second, and internally converted to page costs:
```
page_cost_quota = byte_quota / CLIENT_KNOBS->READ_COST_BYTE_FACTOR
page_cost_quota = ceiling(byte_quota / CLIENT_KNOBS->READ_COST_BYTE_FACTOR)
```
### Limit Calculation

View File

@ -90,9 +90,9 @@ ACTOR Future<Void> setQuota(Reference<IDatabase> db, TransactionTag tag, LimitTy
// Internally, costs are stored in terms of pages, but in the API,
// costs are specified in terms of bytes
if (limitType == LimitType::TOTAL) {
quota.totalQuota = value / CLIENT_KNOBS->READ_COST_BYTE_FACTOR;
quota.totalQuota = (value - 1) / CLIENT_KNOBS->READ_COST_BYTE_FACTOR + 1;
} else if (limitType == LimitType::RESERVED) {
quota.reservedQuota = value / CLIENT_KNOBS->READ_COST_BYTE_FACTOR;
quota.reservedQuota = (value - 1) / CLIENT_KNOBS->READ_COST_BYTE_FACTOR + 1;
}
ThrottleApi::setTagQuota(tr, tag, quota.reservedQuota, quota.totalQuota);
wait(safeThreadFutureToFuture(tr->commit()));