Re: pgsql: Allow vacuum command to process indexes in parallel.

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Amit Kapila <akapila(at)postgresql(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Allow vacuum command to process indexes in parallel.
Date: 2020-04-02 02:14:04
Message-ID: CAA4eK1JjFbF7+8-kbFzyN4EJzaSjvYgd64hgMVehq+-5yLdSzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, Apr 1, 2020 at 8:39 AM Mahendra Singh Thalor <mahi6run(at)gmail(dot)com> wrote:
>
> On Tue, 31 Mar 2020 at 17:28, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Mon, Mar 30, 2020 at 8:30 AM Mahendra Singh Thalor
> > <mahi6run(at)gmail(dot)com> wrote:
> > >
> > > > > > 2077 if ((shared_balance >= VacuumCostLimit) &&
> > > > > > >>> CID ...: Incorrect expression (UNINTENDED_INTEGER_DIVISION)
> > > > > > >>> Dividing integer expressions "VacuumCostLimit" and "nworkers", and then converting the integer quotient to type "double". Any remainder, or fractional part of the quotient, is ignored.
> > > > > > 2078 (VacuumCostBalanceLocal > 0.5 * (VacuumCostLimit / nworkers)))
> > > > > > 2079 {
> > > > > > 2080 /* Compute sleep time based on the local cost balance */
> > > > > > 2081 msec = VacuumCostDelay * VacuumCostBalanceLocal / VacuumCostLimit;
> > > > > > 2082 pg_atomic_sub_fetch_u32(VacuumSharedCostBalance, VacuumCostBalanceLocal);
> > > > > > 2083 VacuumCostBalanceLocal = 0;
> > > > >
> > > > > Which seems like a fair enough complaint?
> > > > >
> > > >
> > > > I'll look into it.
> > > >
> > >
> > > Hi,
> > > Attaching patch to fix this but I don't have coverity setup so I
> > > haven't verified fix.
> > >
> >
> > - (VacuumCostBalanceLocal > 0.5 * (VacuumCostLimit / nworkers)))
> > + (VacuumCostBalanceLocal > (int) (0.5 * ((double) VacuumCostLimit /
> > nworkers))))
> > {
> >
> > I think typecasting to double should be enough to fix this coverity error.
>
> I also think same so attaching updated patch.
>

Thanks, I have pushed this patch yesterday.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2020-04-02 02:21:54 pgsql: Allow pg_stat_statements to track planning statistics.
Previous Message Tomas Vondra 2020-04-02 00:39:57 pgsql: Collect statistics about SLRU caches