From: Amit Kapila Date: Wed, 1 Apr 2020 03:58:13 +0000 (+0530) Subject: Fix coverity complaint about commit 40d964ec99. X-Git-Tag: REL_13_BETA1~389 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2401d93718310237b3cb1ff914abc1bcbdd8e1dc;p=thirdparty%2Fpostgresql.git Fix coverity complaint about commit 40d964ec99. The coverity complained that dividing integer expressions and then converting the integer quotient to type "double" would lose fractional part. Typecasting one of the arguments of expression with double should fix the report. Author: Mahendra Singh Thalor Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/20200329224818.6phnhv7o2q2rfovf@alap3.anarazel.de --- diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 59731d687f6..3a89f8fe1e2 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -2077,7 +2077,7 @@ compute_parallel_delay(void) VacuumCostBalanceLocal += VacuumCostBalance; if ((shared_balance >= VacuumCostLimit) && - (VacuumCostBalanceLocal > 0.5 * (VacuumCostLimit / nworkers))) + (VacuumCostBalanceLocal > 0.5 * ((double) VacuumCostLimit / nworkers))) { /* Compute sleep time based on the local cost balance */ msec = VacuumCostDelay * VacuumCostBalanceLocal / VacuumCostLimit;