agora inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH v13 3/8] Row pattern recognition patch (rewriter).
793+ messages / 2 participants
[nested] [flat]

* [PATCH v13 3/8] Row pattern recognition patch (rewriter).
@ 2024-01-22 09:45  Tatsuo Ishii <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Tatsuo Ishii @ 2024-01-22 09:45 UTC (permalink / raw)

---
 src/backend/utils/adt/ruleutils.c | 90 +++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 0b2a164057..baded88201 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -428,6 +428,10 @@ static void get_rule_groupingset(GroupingSet *gset, List *targetlist,
 								 bool omit_parens, deparse_context *context);
 static void get_rule_orderby(List *orderList, List *targetList,
 							 bool force_colno, deparse_context *context);
+static void get_rule_pattern(List *patternVariable, List *patternRegexp,
+							 bool force_colno, deparse_context *context);
+static void get_rule_define(List *defineClause, List *patternVariables,
+							bool force_colno, deparse_context *context);
 static void get_rule_windowclause(Query *query, deparse_context *context);
 static void get_rule_windowspec(WindowClause *wc, List *targetList,
 								deparse_context *context);
@@ -6459,6 +6463,64 @@ get_rule_orderby(List *orderList, List *targetList,
 	}
 }
 
+/*
+ * Display a PATTERN clause.
+ */
+static void
+get_rule_pattern(List *patternVariable, List *patternRegexp,
+				 bool force_colno, deparse_context *context)
+{
+	StringInfo  buf = context->buf;
+	const char *sep;
+	ListCell   *lc_var, *lc_reg = list_head(patternRegexp);
+
+	sep = "";
+	appendStringInfoChar(buf, '(');
+	foreach(lc_var, patternVariable)
+	{
+		char *variable = strVal((String *) lfirst(lc_var));
+		char *regexp = NULL;
+
+		if (lc_reg != NULL)
+		{
+			regexp = strVal((String *) lfirst(lc_reg));
+			lc_reg = lnext(patternRegexp, lc_reg);
+		}
+
+		appendStringInfo(buf, "%s%s", sep, variable);
+		if (regexp != NULL)
+			appendStringInfoString(buf, regexp);
+
+		sep = " ";
+	}
+	appendStringInfoChar(buf, ')');
+}
+
+/*
+ * Display a DEFINE clause.
+ */
+static void
+get_rule_define(List *defineClause, List *patternVariables,
+				bool force_colno, deparse_context *context)
+{
+	StringInfo  buf = context->buf;
+	const char *sep;
+	ListCell   *lc_var, *lc_def;
+
+	sep = "  ";
+	Assert(list_length(patternVariables) == list_length(defineClause));
+
+	forboth(lc_var, patternVariables, lc_def, defineClause)
+	{
+		char *varName = strVal(lfirst(lc_var));
+		TargetEntry *te = (TargetEntry *) lfirst(lc_def);
+
+		appendStringInfo(buf, "%s%s AS ", sep, varName);
+		get_rule_expr((Node *) te->expr, context, false);
+		sep = ",\n  ";
+	}
+}
+
 /*
  * Display a WINDOW clause.
  *
@@ -6596,6 +6658,34 @@ get_rule_windowspec(WindowClause *wc, List *targetList,
 			appendStringInfoString(buf, "EXCLUDE GROUP ");
 		else if (wc->frameOptions & FRAMEOPTION_EXCLUDE_TIES)
 			appendStringInfoString(buf, "EXCLUDE TIES ");
+		/* RPR */
+		if (wc->rpSkipTo == ST_NEXT_ROW)
+			appendStringInfoString(buf, "\n  AFTER MATCH SKIP TO NEXT ROW ");
+		else if (wc->rpSkipTo == ST_PAST_LAST_ROW)
+			appendStringInfoString(buf, "\n  AFTER MATCH SKIP PAST LAST ROW ");
+		else if (wc->rpSkipTo == ST_FIRST_VARIABLE)
+			appendStringInfo(buf, "\n  AFTER MATCH SKIP TO FIRST %s ", wc->rpSkipVariable);
+		else if (wc->rpSkipTo == ST_LAST_VARIABLE)
+			appendStringInfo(buf, "\n  AFTER MATCH SKIP TO LAST %s ", wc->rpSkipVariable);
+		else if (wc->rpSkipTo == ST_VARIABLE)
+			appendStringInfo(buf, "\n  AFTER MATCH SKIP TO %s ", wc->rpSkipVariable);
+
+		if (wc->initial)
+			appendStringInfoString(buf, "\n  INITIAL");
+
+		if (wc->patternVariable)
+		{
+			appendStringInfoString(buf, "\n  PATTERN ");
+			get_rule_pattern(wc->patternVariable, wc->patternRegexp, false, context);
+		}
+
+		if (wc->defineClause)
+		{
+			appendStringInfoString(buf, "\n  DEFINE\n");
+			get_rule_define(wc->defineClause, wc->patternVariable, false, context);
+			appendStringInfoChar(buf, ' ');
+		}
+
 		/* we will now have a trailing space; remove it */
 		buf->len--;
 	}
-- 
2.25.1


----Next_Part(Mon_Jan_22_19_26_18_2024_011)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="v13-0004-Row-pattern-recognition-patch-planner.patch"



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread

* [PATCH v1 3/4] autovac: combine reloptions correctly
@ 2025-06-23 20:16  Nathan Bossart <[email protected]>
  0 siblings, 0 replies; 793+ messages in thread

From: Nathan Bossart @ 2025-06-23 20:16 UTC (permalink / raw)

---
 src/backend/postmaster/autovacuum.c | 85 +++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 3bedca971ff..0d1f4e38b58 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1873,6 +1873,73 @@ get_database_list(void)
 	return dblist;
 }
 
+static void
+combine_relopts(StdRdOptions *toast_opts, const StdRdOptions *main_opts)
+{
+	AutoVacOpts *toast_avopts = &toast_opts->autovacuum;
+	const AutoVacOpts *main_avopts = &main_opts->autovacuum;
+
+	/* XXX: need isset_offset to combine "enabled" */
+
+	if (toast_avopts->vacuum_threshold == -1)
+		toast_avopts->vacuum_threshold = main_avopts->vacuum_threshold;
+
+	if (toast_avopts->vacuum_max_threshold == -2)
+		toast_avopts->vacuum_max_threshold = main_avopts->vacuum_max_threshold;
+
+	if (toast_avopts->vacuum_ins_threshold == -2)
+		toast_avopts->vacuum_ins_threshold = main_avopts->vacuum_ins_threshold;
+
+	if (toast_avopts->analyze_threshold == -1)
+		toast_avopts->analyze_threshold = main_avopts->analyze_threshold;
+
+	if (toast_avopts->vacuum_cost_limit == -1)
+		toast_avopts->vacuum_cost_limit = main_avopts->vacuum_cost_limit;
+
+	if (toast_avopts->freeze_min_age == -1)
+		toast_avopts->freeze_min_age = main_avopts->freeze_min_age;
+
+	if (toast_avopts->freeze_max_age == -1)
+		toast_avopts->freeze_max_age = main_avopts->freeze_max_age;
+
+	if (toast_avopts->freeze_table_age == -1)
+		toast_avopts->freeze_table_age = main_avopts->freeze_table_age;
+
+	if (toast_avopts->multixact_freeze_min_age == -1)
+		toast_avopts->multixact_freeze_min_age = main_avopts->multixact_freeze_min_age;
+
+	if (toast_avopts->multixact_freeze_max_age == -1)
+		toast_avopts->multixact_freeze_max_age = main_avopts->multixact_freeze_max_age;
+
+	if (toast_avopts->multixact_freeze_table_age == -1)
+		toast_avopts->multixact_freeze_table_age = main_avopts->multixact_freeze_table_age;
+
+	/* XXX: need isset_offset for log_min_duration */
+
+	if (toast_avopts->vacuum_cost_delay == -1)
+		toast_avopts->vacuum_cost_delay = main_avopts->vacuum_cost_delay;
+
+	if (toast_avopts->vacuum_scale_factor == -1)
+		toast_avopts->vacuum_scale_factor = main_avopts->vacuum_scale_factor;
+
+	if (toast_avopts->vacuum_ins_scale_factor == -1)
+		toast_avopts->vacuum_ins_scale_factor = main_avopts->vacuum_ins_scale_factor;
+
+	if (toast_avopts->analyze_scale_factor == -1)
+		toast_avopts->analyze_scale_factor = main_avopts->analyze_scale_factor;
+
+	/* XXX: need isset_offset for vacuum_index_cleanup */
+
+	if (!toast_opts->vacuum_truncate_set && main_opts->vacuum_truncate_set)
+	{
+		toast_opts->vacuum_truncate = main_opts->vacuum_truncate;
+		toast_opts->vacuum_truncate_set = true;
+	}
+
+	if (toast_opts->vacuum_max_eager_freeze_failure_rate == -1)
+		toast_opts->vacuum_max_eager_freeze_failure_rate = main_opts->vacuum_max_eager_freeze_failure_rate;
+}
+
 /*
  * Process a database table-by-table
  *
@@ -2113,7 +2180,16 @@ do_autovacuum(void)
 		 */
 		relopts = (StdRdOptions *) extractRelOptions(tuple, pg_class_desc, NULL);
 		if (relopts)
+		{
+			av_relation *hentry;
+			bool		found;
+
 			free_relopts = true;
+
+			hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+			if (found && hentry->ar_hasrelopts)
+				combine_relopts(relopts, &hentry->ar_reloptions);
+		}
 		else
 		{
 			av_relation *hentry;
@@ -2733,7 +2809,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
 	 */
 	relopts = (StdRdOptions *) extractRelOptions(classTup, pg_class_desc, NULL);
 	if (relopts)
+	{
+		av_relation *hentry;
+		bool		found;
+
 		free_relopts = true;
+
+		hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
+		if (found && hentry->ar_hasrelopts)
+			combine_relopts(relopts, &hentry->ar_reloptions);
+	}
 	else if (classForm->relkind == RELKIND_TOASTVALUE &&
 			 table_toast_map != NULL)
 	{
-- 
2.39.5 (Apple Git-154)


--QWBYbd5Ar5k8NvSv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0004-combine-relopts-correctly-for-VACUUM-commands.patch



^ permalink  raw  reply  [nested|flat] 793+ messages in thread


end of thread, other threads:[~2025-06-23 20:16 UTC | newest]

Thread overview: 793+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22 09:45 [PATCH v13 3/8] Row pattern recognition patch (rewriter). 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]>
2025-06-23 20:16 [PATCH v1 3/4] autovac: 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