pgsql: Split vacuumdb to create vacuuming.c/h - Mailing list pgsql-committers

From Álvaro Herrera
Subject pgsql: Split vacuumdb to create vacuuming.c/h
Date
Msg-id E1v29LY-000BL6-0j@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Álvaro Herrera
Date:
Subject: pgsql: Create a separate file listing backend types
Next
From: Masahiko Sawada
Date:
Subject: pgsql: Remove unused for_all_tables field from AlterPublicationStmt.