Re: parallel vacuum comments

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Peter Geoghegan <pg@bowt.ie>, Andres Freund <andres@anarazel.de>
Date: 2021-11-24T02:47:09Z
Lists: pgsql-hackers
On Wed, Nov 24, 2021 at 7:48 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> On Fri, Nov 19, 2021 at 11:25 AM houzj.fnst@fujitsu.com
> <houzj.fnst@fujitsu.com> wrote:
> >
> > 3)
> >
> > +       /*
> > +        * Reset all index status back to invalid (while checking that we have
> > +        * processed all indexes).
> > +        */
> > +       for (int i = 0; i < pvs->nindexes; i++)
> > +       {
> > +               PVIndStats *stats = &(pvs->indstats[i]);
> > +
> > +               Assert(stats->status == INDVAC_STATUS_COMPLETED);
> > +               stats->status = INDVAC_STATUS_INITIAL;
> > +       }
> >
> > Would it be safer if we report an error if any index's status is not
> > INDVAC_STATUS_COMPLETED ?
>
> Agreed. It'd be safer since even if some indexes are vacuumed due to a
> bug vacuum errored out rather than continue it (and cause index
> corruption).
>

I think if we want to report an error in this case, we should use elog
as this is an internal error.

-- 
With Regards,
Amit Kapila.



Commits

  1. Move parallel vacuum code to vacuumparallel.c.

  2. Move index vacuum routines to vacuum.c.

  3. Improve parallel vacuum implementation.

  4. Fix parallel amvacuumcleanup safety bug.

  5. Simplify state managed by VACUUM.