Re: Fixes inconsistent behavior in vacuum when it processes multiple relations

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, shihao zhong <zhong950419(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fixes inconsistent behavior in vacuum when it processes multiple relations
Date: 2026-03-26 02:22:25
Message-ID: acSYYcbfDk0bSgGq@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 25, 2026 at 10:33:48AM -0500, Nathan Bossart wrote:
> On Tue, Mar 24, 2026 at 11:29:52PM -0400, Andres Freund wrote:
> > I wonder if more of the code in the function should be updated to use the
> > copy, otherwise it seems like it could more easily happen that a part of the
> > code not using the modified version is moved until after a modification, and
> > the code author assumes the modifications now have taken effect.
>
> Yeah, I was waffling on this. I updated the rest of the function to use
> params_local instead.

Fine by me with these extra forward declarations and the pointer
manipulations across these VACUUM/ANALYZE calls. That would be
protective enough in terms of the original intention of these const
markers added in 2252fcd4276c.

Once vacuum_rel() has its VacuumParams changed to a pointer, renaming
it to params_local and use params_local in all its code paths looks
sensible. On top of what you are doing, I would add a big warning
comment at the top of the routine to mention that "params" should not
be used directly in the routine. The local copies should be used.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2026-03-26 02:25:29 Re: Track skipped tables during autovacuum and autoanalyze
Previous Message Lukas Fittl 2026-03-26 01:34:02 Re: Refactor query normalization into core query jumbling