Rationalize handling of VacuumParams
Michael Paquier <michael@paquier.xyz>
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: https://postgr.es/m/CAGRkXqTo+aK=GTy5pSc-9cy8H2F2TJvcrZ-zXEiNJj93np1UUw@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/heap/vacuumlazy.c | modified | +22 −22 |
| src/backend/commands/analyze.c | modified | +13 −13 |
| src/backend/commands/cluster.c | modified | +1 −1 |
| src/backend/commands/vacuum.c | modified | +53 −65 |
| src/backend/postmaster/autovacuum.c | modified | +1 −1 |
| src/include/access/heapam.h | modified | +2 −2 |
| src/include/access/tableam.h | modified | +3 −3 |
| src/include/commands/vacuum.h | modified | +3 −3 |
Discussion
- Fixes inconsistent behavior in vacuum when it processes multiple relations 32 messages · 2025-06-18 → 2026-03-31