Fix undefined behavior when retries is too large (#8180)
fdbclient/PaxosConfigTransaction.actor.cpp:221:77: runtime error: shift exponent 32 is too large for 32-bit type 'int' I confirmed that 1 << 30 is not UB
This commit is contained in:
parent
d2b82d2c46
commit
0afa24bb3f
|
@ -218,8 +218,8 @@ class GetGenerationQuorum {
|
|||
if (self->coordinatorsChangedFuture.isReady()) {
|
||||
throw coordinators_changed();
|
||||
}
|
||||
wait(delayJittered(
|
||||
std::clamp(0.005 * (1 << retries), 0.0, CLIENT_KNOBS->TIMEOUT_RETRY_UPPER_BOUND)));
|
||||
wait(delayJittered(std::clamp(
|
||||
0.005 * (1 << std::min(retries, 30)), 0.0, CLIENT_KNOBS->TIMEOUT_RETRY_UPPER_BOUND)));
|
||||
if (deterministicRandom()->random01() < 0.05) {
|
||||
// Randomly inject a delay of at least the generation
|
||||
// reply timeout, to try to prevent contention between
|
||||
|
|
Loading…
Reference in New Issue