Hi,
I looked these patches while looking at potential cases for injection point
conditional strings [0], which could allow for better autovacuum testing,
particularly for the case being discussed here.
As far as the patches go, No comments on 0001-0004, just two nits on 0005.
1/ Instead of setting toast_vacuum_params.* inside each branch, it reads
cleaner to set toast_vacuum_params.* after params.* is done, and this
way you only set toast_vacuum_params.*once. For example, in
index_cleanup:
@@ -2223,15 +2223,12 @@ vacuum_rel(Oid relid, RangeVar *relation,
VacuumParams params,
case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
params.index_cleanup = VACOPTVALUE_ENABLED;
- toast_vacuum_params.main_index_cleanup = VACOPTVALUE_ENABLED;
break;
...
}
+
+ /* A TOAST table inherits the main relation's value. */
+ toast_vacuum_params.main_index_cleanup = params.index_cleanup;
}
The same applies to main_max_eager_freeze_failure_rate and main_truncate.
2/ A couple of comment tweaks in merge_autovac_opts()
```
@@ -3791,8 +3791,11 @@ pg_stat_get_autovacuum_scores(PG_FUNCTION_ARGS)
* The arrays below cover only the options that can be set on a TOAST table,
* grouped by the value that means "unset". Both of those facts come from
* reloptions.c, so they must be kept in sync with the entries here.
+ * Analyze options are intentionally excluded because TOAST tables are never
+ * analyzed, and autovacuum_parallel_workers is excluded because it can't be
+ * set on a TOAST table.
*
- * NB: This function destructively modifies toast_opts!
+ * NB: This modifies toast_opts in place.
*/
static StdRdOptions *
merge_autovac_opts(StdRdOptions *toast_opts, StdRdOptions *main_opts)
@@ -3821,7 +3824,7 @@ merge_autovac_opts(StdRdOptions *toast_opts,
StdRdOptions *main_opts)
offsetof(AutoVacOpts, log_vacuum_min_duration),
};
- /* float fields */
+ /* float fields whose unset sentinel is -1.0 */
static const int float_offsets[] = {
offsetof(AutoVacOpts, vacuum_cost_delay),
offsetof(AutoVacOpts, vacuum_scale_factor),
```
[0]
https://www.postgresql.org/message-id/CAA5RZ0sfRTST8RQaoVXfEnVRchRtAP_YhFFUVcm6dC6v1TAChw%40mail.gmail.com
--
Sami Imseih
Amazon Web Services (AWS)