Rationalize handling of VacuumParams
authorMichael Paquier <michael@paquier.xyz>
Mon, 30 Jun 2025 06:42:50 +0000 (15:42 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 30 Jun 2025 06:42:50 +0000 (15:42 +0900)
commit2252fcd4276cfeabae8786ab7c5a421dd674743e
treec1cb02406275c70361ca799ef2f8c304fa7637e7
parent5ba00e175a4eaefa4dc38ea14c667bbeb13af305
Rationalize handling of VacuumParams

This commit refactors the vacuum routines that rely on VacuumParams,
adding const markers where necessary to force a new policy in the code.
This structure should not use a pointer as it may be used across
multiple relations, and its contents should never be updated.
vacuum_rel() stands as an exception as it touches the "index_cleanup"
and "truncate" options.

VacuumParams has been introduced in 0d831389749a, and 661643dedad9 has
fixed a bug impacting VACUUM operating on multiple relations.  The
changes done in tableam.h break ABI compatibility, so this commit can
only happen on HEAD.

Author: Shihao Zhong <zhong950419@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Discussion: http://postgr.es/m/CAGRkXqTo+aK=GTy5pSc-9cy8H2F2TJvcrZ-zXEiNJj93np1UUw@mail.gmail.com
src/backend/access/heap/vacuumlazy.c
src/backend/commands/analyze.c
src/backend/commands/cluster.c
src/backend/commands/vacuum.c
src/backend/postmaster/autovacuum.c
src/include/access/heapam.h
src/include/access/tableam.h
src/include/commands/vacuum.h