Fix VACUUM's handling of TOAST storage parameters.
Per the documentation for CREATE TABLE:
If a table parameter value is set and the equivalent toast.
parameter is not, the TOAST table will use the table's
parameter value.
Presently, VACUUM does no such thing. It reads the TOAST table's
own reloptions, which hold only what was set through toast.*, so
vacuum_index_cleanup, vacuum_max_eager_freeze_failure_rate, and
vacuum_truncate settings on the main table have no effect on its
TOAST table.
To fix, add merge_toast_reloptions(), which walks the parse table
for StdRdOptions and takes the main table's value for anything the
TOAST table left at its default. vacuum_rel() hands the main
table's parameters down when recursing to a TOAST table, and it
merges them into a copy of the TOAST table's parameters before the
values are used. This doesn't help VACUUM against a TOAST table
directly (e.g., "VACUUM pg_toast.pg_toast_5432"), but that's
probably okay because it's not the main supported way to vacuum a
TOAST table (see VACUUM's PROCESS_MAIN and PROCESS_TOAST options).
A follow-up commit will do the same for autovacuum. While this is
a bug fix, it's too intrusive for back-patching, but the issue
seems to have gone unnoticed for a very long time, anyway.
Reviewed-by: Michael Paquier <[email protected]>
Reviewed-by: Sami Imseih <[email protected]>
Reviewed-by: Greg Burd <[email protected]>
Tested-by: solai v <[email protected]>
Discussion: https://postgr.es/m/aFRxC1W_kZU9OjJ9%40nathan
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c244c62d8b9e7762be3d35090463c76042ab7f89
Modified Files
--------------
src/backend/access/common/reloptions.c | 104 +++++++++++++++++++++
src/backend/commands/vacuum.c | 41 +++++---
src/backend/postmaster/autovacuum.c | 1 +
src/include/access/reloptions.h | 2 +
src/include/commands/vacuum.h | 8 ++
.../modules/injection_points/expected/vacuum.out | 11 +++
src/test/modules/injection_points/sql/vacuum.sql | 8 ++
7 files changed, 164 insertions(+), 11 deletions(-)