From: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Split vacuumdb to create vacuuming.c/h
Date: Fri, 26 Sep 2025 14:22:52 +0000
Message-ID: <E1v29LY-000BL6-0j@gemulon.postgresql.org> (raw)
Split vacuumdb to create vacuuming.c/h
This allows these routines to be reused by a future utility heavily
based on vacuumdb.
I made a few relatively minor changes from the original, most notably:
- objfilter was declared as an enum but the values are bit-or'ed, and
individual bits are tested throughout the code. We've discussed this
coding pattern in other contexts and stayed away from it, on the
grounds that the values so generated aren't really true values of the
enum. This commit changes it to be a bits32 with a few #defines for
the flag definitions, the way we do elsewhere. Also, instead of being
a global variable, it's now in the vacuumingOptions struct.
- Two booleans, analyze_only (in vacuumingOptions) and analyze_in_stages
(passed around as a separate boolean argument), are really determining
what "mode" the program runs in -- it's either vacuum, or one of those
two modes. I have three adjectives for them: inconsistent,
unergonomic, unorthodox. Removing these and replacing them with a
mode enum to be kept in vacuumingOptions makes the code structure easier
to understand in a couple of places, and it'll be useful for the new
mode we add next, so do that.
Reviewed-by: Antonin Houska <ah@cybertec.at>
Discussion: https://postgr.es/m/202508301750.cbohxyy2pcce@alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c4067383cb2c155c4cfea2351036709e2ebb3535
Modified Files
--------------
src/bin/scripts/Makefile | 4 +-
src/bin/scripts/meson.build | 28 +-
src/bin/scripts/nls.mk | 1 +
src/bin/scripts/vacuumdb.c | 1085 ++------------------------------------
src/bin/scripts/vacuuming.c | 1004 +++++++++++++++++++++++++++++++++++
src/bin/scripts/vacuuming.h | 72 +++
src/tools/pgindent/typedefs.list | 1 +
7 files changed, 1146 insertions(+), 1049 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@kurilemu.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Split vacuumdb to create vacuuming.c/h
In-Reply-To: <E1v29LY-000BL6-0j@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox