Update setQuota function in QuotaCommand.actor.cpp to round up to nearest page size
This commit is contained in:
parent
4d9d0afe01
commit
16fe88948e
|
@ -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
|
||||
|
|
|
@ -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()));
|
||||
|
|
Loading…
Reference in New Issue