agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v17 8/8] Allow to print raw parse tree. 791+ messages / 2 participants [nested] [flat]
* [PATCH v17 8/8] Allow to print raw parse tree. @ 2024-04-28 11:00 Tatsuo Ishii <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Tatsuo Ishii @ 2024-04-28 11:00 UTC (permalink / raw) --- src/backend/tcop/postgres.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 2dff28afce..db6e91f5d6 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -653,6 +653,10 @@ pg_parse_query(const char *query_string) } #endif + if (Debug_print_parse) + elog_node_display(LOG, "raw parse tree", raw_parsetree_list, + Debug_pretty_print); + TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string); return raw_parsetree_list; -- 2.25.1 ----Next_Part(Sun_Apr_28_20_28_26_2024_444)---- ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
* [PATCH v1 3/4] autovac: combine reloptions correctly @ 2025-06-23 20:16 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 791+ messages in thread From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw) --- src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 3bedca971ff..0d1f4e38b58 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1873,6 +1873,73 @@ get_database_list(void) return dblist; } +static void +combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts) +{ + AutoVacOpts *toast_avopts = &toast_opts->autovacuum; + const AutoVacOpts *main_avopts = &main_opts->autovacuum; + + /* XXX: need isset_offset to combine "enabled" */ + + if (toast_avopts->vacuum_threshold == -1) + toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold; + + if (toast_avopts->vacuum_max_threshold == -2) + toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold; + + if (toast_avopts->vacuum_ins_threshold == -2) + toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold; + + if (toast_avopts->analyze_threshold == -1) + toast_avopts->analyze_threshold = main_avopts->analyze_threshold; + + if (toast_avopts->vacuum_cost_limit == -1) + toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit; + + if (toast_avopts->freeze_min_age == -1) + toast_avopts->freeze_min_age = main_avopts->freeze_min_age; + + if (toast_avopts->freeze_max_age == -1) + toast_avopts->freeze_max_age = main_avopts->freeze_max_age; + + if (toast_avopts->freeze_table_age == -1) + toast_avopts->freeze_table_age = main_avopts->freeze_table_age; + + if (toast_avopts->multixact_freeze_min_age == -1) + toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age; + + if (toast_avopts->multixact_freeze_max_age == -1) + toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age; + + if (toast_avopts->multixact_freeze_table_age == -1) + toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age; + + /* XXX: need isset_offset for log_min_duration */ + + if (toast_avopts->vacuum_cost_delay == -1) + toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay; + + if (toast_avopts->vacuum_scale_factor == -1) + toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor; + + if (toast_avopts->vacuum_ins_scale_factor == -1) + toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor; + + if (toast_avopts->analyze_scale_factor == -1) + toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor; + + /* XXX: need isset_offset for vacuum_index_cleanup */ + + if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set) + { + toast_opts->vacuum_truncate = main_opts->vacuum_truncate; + toast_opts->vacuum_truncate_set = true; + } + + if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1) + toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate; +} + /* * Process a database table-by-table * @@ -2113,7 +2180,16 @@ do_autovacuum(void) */ relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else { av_relation *hentry; @@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, */ relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL); if (relopts) + { + av_relation *hentry; + bool found; + free_relopts = true; + + hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); + if (found && hentry->ar_hasrelopts) + combine_relopts(relopts, &hentry->ar_reloptions); + } else if (classForm->relkind == RELKIND_TOASTVALUE && table_toast_map != NULL) { -- 2.39.5 (Apple Git-154) --QWBYbd5Ar5k8NvSv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch ^ permalink raw reply [nested|flat] 791+ messages in thread
end of thread, other threads:[~2025-06-23 20:16 UTC | newest] Thread overview: 791+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-04-28 11:00 [PATCH v17 8/8] Allow to print raw parse tree. Tatsuo Ishii <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]> 2025-06-23 20:16 [PATCH v1 3/4] autovac: combine reloptions correctly Nathan Bossart <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox