Avoid casting NaN to int
Apparently it's possible for dbSizeEstimate to be negative
This commit is contained in:
parent
6992f5814b
commit
f5d312e4a0
|
@ -176,8 +176,8 @@ ShardSizeBounds getShardSizeBounds(KeyRangeRef shard, int64_t maxShardSize) {
|
|||
}
|
||||
|
||||
int64_t getMaxShardSize(double dbSizeEstimate) {
|
||||
return std::min((SERVER_KNOBS->MIN_SHARD_BYTES +
|
||||
(int64_t)std::sqrt(dbSizeEstimate) * SERVER_KNOBS->SHARD_BYTES_PER_SQRT_BYTES) *
|
||||
return std::min((SERVER_KNOBS->MIN_SHARD_BYTES + (int64_t)std::sqrt(std::max<double>(dbSizeEstimate, 0)) *
|
||||
SERVER_KNOBS->SHARD_BYTES_PER_SQRT_BYTES) *
|
||||
SERVER_KNOBS->SHARD_BYTES_RATIO,
|
||||
(int64_t)SERVER_KNOBS->MAX_SHARD_BYTES);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue